PowerShell script cannot be loaded because running scripts is disabled on this system.

When you run a PowerShell script in the PowerShell terminal for the first time , sometimes you might get the below error.

image

File <Path>.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see
about_Execution_Policies at
http://go.microsoft.com/fwlink/?LinkID=135170.
+ CategoryInfo          : SecurityError: (:) [], ParentContainsErrorRecord
Exception
+ FullyQualifiedErrorId : UnauthorizedAccess

 

In order to fix this error , you need to enable or activate PowerShell on your system.

Follow the below steps to activate or enable the PowerShell on your system.

1. Run PowerShell terminal in administrator mode (Elevated mode).

2. Execute the following command
set-executionpolicy remotesigned

3. Type Y for Yes and press the enter key.

4. Now , you should able to run PowerShell scripts in the PowerShell terminal.

Leave a Reply