Wednesday, July 20, 2016

Windows PowerShell - "running scripts is disabled on this system."

When I try to execute my .ps1 script in Windows PowerShell ISE window, it is throwing exception like below:

"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: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnauthorizedAccess  "

I found the solution one the article from the Internet.

This error happens due to a security measure which won't let scripts be executed on your system without you having approved of it. 

You can do it by set the execution policy in powershell command window.

Open the Windows PowerShell with "Run as administrator" and enter the below command:

set-executionpolicy remotesigned

No comments:

Post a Comment