Home » Softwares » Visual Studio » Power Shell refuses to execute script inside Visual Studio

Power Shell refuses to execute script inside Visual Studio

If you are running Visual Studio 2013 and execute inside the Package Manager Console a Power Shell script, you may stumble into a failure. A message concerning PSSecurityException that cannot load the script because of something disabled. Even if few minutes ago you were able to run the command, this can appear.

Script.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see “get-help about_signing” for more details.

The trick is to execute the following line.

Set-ExecutionPolicy RemoteSigned

This will raise a question that you have to write “y” to accept.

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 policy?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"):y

If you like my article, think to buy my annual book, professionally edited by a proofreader. directly from me or on Amazon. I also wrote a TypeScript book called Holistic TypeScript

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.