Allowing Powershell Scripts to Run on Windows
March 5, 2017
Posted by on
So you want to run a PowerShell script on your Windows system but get the following message:
File myscript.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please
see "get-help about_signing" for more details.
At line:1 char:23
+ .\myscript.ps1 <<<<
+ CategoryInfo : NotSpecified: (:) , PSSecurityException
+ FullyQualifiedErrorId : RuntimeException
A fix is to change the execution policy. To see the current state of execution policies on your system:
PS C:\> Get-ExecutionPolicy -List |Format-Table -AutoSize
If you do not have administrator rights on your system the easiest way to allow scripts to be executed is to allow the current user to run scripts.
PS C:\> Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned
Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose
you to the security risks described in the about_Execution_Policies help topic. Do you want to change the execution
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): y
Note that “RemoteSigned” means that all scripts and configuration files downloaded from the Internet must be signed by a trusted publisher, but locally authored scripts can be run without a signature.