Chat with us, powered by LiveChat



Error: "execution of scripts is disabled on this system" – Allowing Powershell Scripts to Execute

1 Jun 2012 by Emma Robinson

Want to save this blog for later? Download it now.

Powershell Scripts allow you to automate common tasks within Windows, Microsoft applications and of course Office 365. You can often download handy scripts written by other people off the internet for use on your own computer.

Unfortunately, these scripts could potentially do bad things that you didn’t expect so Microsoft has protected you from this by disabling Powershell scripts by default on Windows 7. Also, you really need to make sure that you only download or use Powershell scripts from a trusted source!

Anyway, if you try and run a Powershell script, you’ll get this helpful error message.

Fortunately, there is an easy way to fix this. You just need to change the Execution policy on your computer using a simple Powershell command.

This will allow you to run scripts that have been written by “a trusted publisher” (Microsoft determines who is trusted and who isn’t).

You can change the RemoteSigned portion of the command above to any of the options in bold below, depending on what you need to achieve.

Restricted – No scripts can be run. Windows PowerShell can be used only in interactive mode (This is the default).
AllSigned – Only scripts signed by a trusted publisher can be run.
RemoteSigned – Downloaded scripts must be signed by a trusted publisher before they can be run.
Unrestricted – No restrictions; all Windows PowerShell scripts can be run.

Read more Optimizing PowerShell for large Office 365 tenants

Once you run the command, you will be asked to Confirm your action. Press Y on the keyboard and enter to confirm. You can see an example here.

You can now run Powershell scripts!

Wait, I got an error!?

Sometimes you will not have permission to set your Execution Policy and you will see an error message like this:

On some computers, you will need Administrator access to run this command. If you are an Administrator, you can fix this by running Powershell as Administrator.

To do this, right-click the Powershell icon and click Run as Administrator. Click Yes to any security warnings that come up and you should be able to run the command as normal!

Changing it back

We recommend you change the remote execution policy back to Restricted when you are done running your script. This prevents evil scripts from running on your computer accidentally. To do this simply change the execution policy back using the command.

For more information on Execution Policies and Scripts, check out these links:

whois: Andy White Freelance WordPress Developer London