Get and Set Execution Policy in PowerShell

The powershell cmdlet Get-ExecutionPolicy tells you which of the four execution policies is currently enabled. The Windows PowerShell execution policies include the following four policies:

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 find the current execution policy run the below cmdlet: The default value is “Restricted.”

Get-ExecutionPolicy

Use the below command to set new execution policy:

Set-ExecutionPolicy RemoteSigned -Force
Advertisement

Leave a Comment