Stuff I Know

Just another WordPress.com weblog

How to enable execution of unsigned PowerShell scripts?

When you try to execute a PowerShell script and get an error like this:

File C:\PSScripts\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

You’ll need to allow running unsigned scripts, or unrestrict the execution policy completely.

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. 

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

Set-ExecutionPolicy unrestricted

 More on http://technet.microsoft.com/en-us/library/ee176949.aspx

 

October 12, 2012 Posted by | Uncategorized | Leave a comment