ExecutionPolicy

This is my first outing with powershell on windows 7, one of the first things I tried to do was install the windows 7 powerpack for powershell. This should have been nice and easy according to the install instructions but when I tried to run the command I was presented with a lovely error message:

“cannot be loaded because the execution of scripts is disabled on this system.”




This error messages seems to be a default response if you try and run any scripts for the first time in powershell (downloaded or created yourself)

It is nice and simple to resolve:

The security settings built into Windows PowerShell include something called the “execution policy” the execution policy determines how (or if) PowerShell runs scripts. By default, PowerShell’s execution policy is set to Restricted; that means that scripts – including those you write yourself – won’t run.

You can check the settings by running:

Get-ExecutionPolicy

There are a number of changes you can make to this variable, one of the options is RemoteSigned

This allows you to run any scripts you create yourself but will only run scripts downloaded (From the internet) only if those scripts have been signed by a trusted publisher.

The command you need to run is:

Set-ExecutionPolicy RemoteSigned

as in the picture above you will be prompted to confirm the changes. Once you type Y you are now able to run your scripts you create without an issue.

Leave a Reply

  

  

  

Time limit is exhausted. Please reload CAPTCHA.