共用方式為


Using the Get-ExecutionPolicy Cmdlet

Listing the Windows PowerShell Script Execution Policy

The Get-ExecutionPolicy cmdlet simply tells you which of the four execution policies (policies that determine which Windows PowerShell scripts, if any, will run on your computer) is currently in-force. The Windows PowerShell execution policies include the following:

  • Restricted - No scripts can be run. Windows PowerShell can be used only in interactive mode.

  • AllSigned - Only scripts signed by a trusted publisher can be run.

  • RemoteSigned - Downloaded scripts must be signed by a trusted publisher before they can be run.

  • Unrestricted - No restrictions; all Windows PowerShell scripts can be run.

To determine the execution policy simply run the cmdlet without any parameters:

Get-ExecutionPolicy

To change the execution policy, use the Set-ExecutionPolicy cmdlet.