5
votes

I have been running my code for past few months by doing this -

Set-ExecutionPolicy Unrestricted

But, something weird is happening and I am getting this error always -

Windows PowerShell updated your execution policy successfully, but the setting is overridden by a policy defined at a more specific scope. Due to the override, your shell will retain its current effective execution policy of "Unrestricted". Type "Get-ExecutionPolicy -List" to view your execution policy settings. For more information, please see "Get-Help Set-ExecutionPolicy."

I have referred these links but no luck -

Get-ExecutionPolicy -List

MachinePolicy                                                           
UserPolicy                                                           
Process                                                        
CurrentUser                                                        
LocalMachine
1
The output of Get-ExecutionPolicy -List should be showing you the execution policy per scope.Keith Hill
It is showing Unrestricted for LocalMachine. But, in between I get the error as I have mentioned above. I don't know why. Its really frustrating !Angshuman Agarwal

1 Answers

1
votes

You should see output like this from Get-ExecutionPolicy -List:

        Scope ExecutionPolicy
        ----- ---------------
MachinePolicy       Undefined
   UserPolicy       Undefined
      Process       Undefined
  CurrentUser       Undefined 
 LocalMachine    RemoteSigned

Once you see the scope that has the undesired setting, you can reset it like so:

Set-ExecutionPolicy Undefined -Scope <scope-name>

That is assuming you have permission to do so.