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.

 

 

Advertisements

One thought on “Changing Script Execution Policies with Powershell

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s