Archive for October, 2016

October 27, 2016

Error: “execution of scripts is disabled on this system”

When you try to execute a SharePoint Online PowerShell command you may come across the above error. Its due to some privacy settings in your local computer.

These scripts could potentially harmful things that you will never expect. 🙂  By default the execution of the PowerShell scripts are disabled by Microsoft. As well as before executing a script you have to make sure that the script is from a reliable source.

To over come the above error you just need to change the Execution policy on your computer using a simple Powershell command as below:

Set-ExecutionPolicy RemoteSigned

when you are done with the above you can execute the script without any issue. Once its done its safe to make the settings to the default as below:

Set-ExecutionPolicy Restricted

You can change the RemoteSigned portion of the command to any of the options as below:

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.