Dec 4, 2009

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

I got this error on Windows PowerShell when I tried to run a script stored in file abc.ps1. The error read:


File C:\sql_job.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see "get-help about_signing" for more details.



Now the solution was that you need to modify the script execution policy to enable powershell to run external scripts. Now there are multiple options here as what could be set but for a developer environment, if you set the execution policy to unrestricted it should do.
To do that, type following at  your powershell command prompt:



PS C:\Documents and Settings\Administrator> set-executionpolicy Unrestricted



PS C:\Documents and Settings\Administrator>


Once you type that and press return key, you will be able to execute your .ps1 script file without any problems. Regarding execution policy options, it is likely candidate for a separate blog post!

You can have a more detailed look regarding execution policy options here http://www.informit.com/articles/article.aspx?p=729101&seqNum=7

No comments:

Post a Comment