First, run the powershell command "Get-ExecutionPolicy -List" (as mentioned in the error message). This will give you a list of the different execution policy scopes and which setting is defined in which scope.
This list of scopes has an order of precedence (MachinePolicy, UserPolicy, Process, CurrentUser, LocalMachine). Each of these scopes can have a different setting;
- Restricted
- AllSigned
- RemoteSigned
- Unrestricted
- Bypass
- Undefined
Powershell will evaluate these scopes in the order listed and apply the first setting that is set to something other than 'Undefined'.
The error you're getting when running 'Set-ExecutionPolicy' indicates that you have a setting of 'Restricted' defined at a more specific scope than the default of LocalMachine. The Get-ExecutionPolicy -List cmdlet will tell you where.
If the Restricted setting is applied in either the LocalUser or Process scopes then you can change this. Use the Set-ExecutionPolicy cmdlet, but specify the scope using the -scope parameter. For example;
Set-ExecutionPolicy -Scope Process RemoteSigned
If the Restricted setting is defined at either the MachinePolicy or UserPolicy scopes then this indicates your domain administrators have configured a group policy that is overriding your local settings. This is where you would need to go and talk to them and see if you can have a less restrictive setting applied via GPO.
To the best of my knowledge you cannot easily override the GPO settings locally; however if I'm wrong on this then someone please do correct me! :)
Best Answer
I was looking for the same. This works on the PowerShell version that comes with Windows 10 TP: