Angshuman Agarwal
Angshuman Agarwal

Reputation: 4866

Powershell : Execution Policy

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

Upvotes: 5

Views: 5280

Answers (1)

Keith Hill
Keith Hill

Reputation: 202072

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.

Upvotes: 1

Related Questions