Friday, July 17, 2009

Downloaded PowerShell Scripts won’t run


When you download PowerShell scripts from the internet you might find that they do not work on your local (DPM) Server.
The reason is PowerShell is configured to run in the most secure mode by default. This mode is the "Restricted" execution policy, in which PowerShell operates as an interactive shell only.

Error message:

The file C:\downloaded_script.ps1 cannot be loaded. The execution of scripts is disabled on this system. Please see "Get-Help about_signing" for more details

You can change this behavior with Set-ExecutionPolicy command in PowerShell

Example:

  • Set-ExecutionPolicy Allsigned (Runs only signed scripts)
  • Set-ExecutionPolicy Unrestricted (Runs all scripts signed and unsigned)

More options and information at: http://www.hanselman.com/blog/SigningPowerShellScripts.aspx

No comments:

Post a Comment