Windows Powershell sets its Execution Policy to Restricted by default, which states that PowerShell can only be used in interactive mode (no scripts will run.) Use the Get-ExecutionPolicy cmdlet to check which execution policy is currently in-force.
$ Get-ExecutionPolicy
The following execution policy definitions are from Microsoft’s website:
- 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 change the execution policy, use Set-ExecutionPolicy. The following will enable you to execute all PowerShell scripts.
$ Set-ExecutionPolicy Unrestricted
