Cannot be Loaded because running Scripts is disabled on this System
- This error comes when the PowerShell execution policy doesn’t allow us to run scripts.
- I also encountered the same error when trying to execute the PowerShell script.
Running Scripts is disabled on this system
- The Set-ExecutionPolicy cmdlet enables you to determine which Windows PowerShell scripts (if any) will be allowed to run on your computer.
- Windows PowerShell has four different execution policies.
Below is the list of four different execution policies in PowerShell.
- Restricted – No Script either local, remote or downloaded can be executed on the system.
- AllSigned – All script that are ran require to be digitally signed.
- RemoteSigned – All remote scripts (UNC) or downloaded need to be signed.
- Unrestricted – No signature for any type of script is required.
Allow PowerShell Scripts
Run the following command to get current execution policy in set in PowerShell.
PS C:\> get-executionpolicy
You can bypass this policy by adding
-ExecutionPolicy ByPass when running PowerShell script.
c:\> powershell -ExecutionPolicy ByPass -File script.ps1