When I try to execute my PowerShell script I get this error:

File C:\Common\Scripts\hello.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:13
+ .\hello.ps1 <<<<
+ CategoryInfo : NotSpecified: (:) [], PSSecurityException
+ FullyQualifiedErrorId : RuntimeException

link|improve this question
feedback

2 Answers

up vote 9 down vote accepted

The Default Execution Policy is set to restricted, you can see it by typing:

Get-ExecutionPolicy

You should type the following to make it go to unrestricted mode:

Set-ExecutionPolicy unrestricted

Hope this helps

link|improve this answer
feedback

Enable running unsigned scripts by entering:

set-executionpolicy remotesigned

This will allow running unsigned scripts that you write on your local computer and signed scripts from Internet.

See also Running Windows PowerShell Scripts

link|improve this answer
2  
+1 for remotesigned instead of unrestricted. You can run your local scripts without exposing yourself to dangers from everywhere else. – DarrellNorton Mar 26 '11 at 13:06
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.