Execution Policies

Execution policies determine which scripts can be run on the machine, and have different scopes / policy levels.

Scopes‚Äč

  • MachinePolicy
  • UserPolicy
  • Process
  • CurrentUser
  • LocalMachine

Policies

  • Restricted
  • AllSigned
  • RemoteSigned
  • Unrestricted

Commands

# List the policy for each scope
Get-ExecutionPolicy -List

# Change the policy for a given scope
Set-ExecutionPolicy -Scope <ScopeName> -ExecutionPolicy <PolicyName>

Troubleshooting

Unable to execute a script

If you can't execute a script because it is unsigned, you can bypass the execution policy for the current terminal process by running the following command:

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass