Tuesday, August 28, 2012

Changing PowerShell script execution settings

If you administer servers on a domain and use Powershell, you might come across this error:

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

Step 1. View the current execution settings

PS C:\> Get-ExecutionPolicy <hit Enter>

It may return "Restricted" which will prevent you from executing any scripts at all...even those written by you.

Step 2. Set the execution setting

PS C:\> Set-ExecutionPolicy RemoteSigned

This will allow you to run only signed scripts and those written by you...provided you have the proper permissions to do so.


No comments:

Post a Comment