Pages

Wednesday, June 10, 2009

Very Famous Error in PowerShell

In this post i would like to give you the solution to a very famous error in PowerShell.

File H:\WindowsPowerShell\profile.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:2+ . <<<< 'H:\\WindowsPowerShell\profile.ps1'

If you are getting the above error it means you are trying to execute some scripts (.ps1) or some configuration files (.ps1xml).

This error is related to the execution Policy of the PowerShell. Use Get-ExecutionPolicy command to find out the current execution policy.

PS H:\> get-ExecutionPolicy
Restricted

Now change the execution policy to "UnRestricted" to resolve or eliminate the error.

PS H:\> Set-ExecutionPolicy UnRestricted
PS H:\>

That's it :)

1 comment:

Anonymous said...

This also removes any hope of protection you have from scripting viruses or malware. The about_signing topic goes into much more detail, but the RemoteSigned execution policy is probably the best trade-off of security and usability.

Lee Holmes [MSFT]
Windows PowerShell Development
Microsoft Corporation