Changing Script Execution Policies with Powershell

First, load up a Powershell prompt in Administrator mode.

Using the command:

Get-ExecutionPolicy -List

will bring up all of the execution policies for the different scopes. This can be seen in the screenshot below.

1

Now that we have our existing execution policies, we want to change them so that scripts can be run on your machine. The two we’re interested in is the “CurrentUser” and the “LocalMachine” scopes.

Given this, we want to change the execution policy for these two to be “RemoteSigned”. This way only the scripts that you authorize will be run, instead of the “Unrestricted” option with would allow Powershell to run ANY script. Obviously this could be a large security risk. With RemoteSigned, it also means that any downloaded scripts will need to be trusted in order to work.

Using the command:

Set-ExecutionPolicy RemoteSigned

When you are presented with the following screen, you want to select the “Yes to All” option or type “A”

2

Finally, we can run the command:

Get-ExecutionPolicy -List

Again which will show that the execution policy has now been changed.

3

You should now be able to run Powershell scripts. Please note that you may need to load then in Powershell ISE and run them which should ask you to make the script trusted or not.


One thought on “Changing Script Execution Policies with Powershell

  1. […] Before you can use scripts, see my post on how to allow them to be run here […]... https://itdelinquent.wordpress.com/2017/03/14/drive-name-checker-against-variable

Leave a Reply