On this page

PowerShell Execution Policies: Complete Guide

Updated on June 26, 2026

Enrico Hochkoeppler Profile

By Enrico Hochkoeppler

Web Developer & TutoriaLibre Founder

PowerShell execution policies are a safety feature that controls the conditions under which PowerShell loads configuration files and runs scripts. They are not a security boundary—users can bypass them by copying script contents directly into the command line—but they provide a governance layer that helps organizations prevent accidental execution of untrusted scripts and enforce safe scripting practices. Execution policies apply only to Windows platforms. On non-Windows computers, the default execution policy is Unrestricted and cannot be changed, though the behavior effectively matches Bypass because those platforms do not implement Windows Security Zones.


What Execution Policies Do​

Execution policies determine whether PowerShell is allowed to run scripts and, if so, which scripts are considered trusted. They help organizations:

Execution policies do not block malicious actors; they are a governance mechanism, not a security boundary.


Available Execution Policy Levels​

PowerShell supports several execution policy modes, each offering different levels of restriction.

PolicyDescriptionRestrictedPermits individual commands but does not allow scripts. Prevents running of all script files, including formatting files (.ps1xml), module script files (.psm1), and PowerShell profiles (.ps1). Default on Windows clients.AllSignedScripts can run. Requires that all scripts and configuration files be signed by a trusted publisher, including scripts written on the local computer. Prompts before running scripts from publishers not yet classified as trusted or untrusted.RemoteSignedThe default execution policy for Windows computers. Scripts can run. Requires a digital signature from a trusted publisher on scripts and configuration files downloaded from the internet (including email and instant messaging). Does not require digital signatures on scripts written locally and not downloaded from the internet.UnrestrictedUnsigned scripts can run. Warns the user before running scripts from outside the local intranet zone. There is a risk of running malicious scripts.BypassNothing is blocked and there are no warnings or prompts. Designed for configurations where PowerShell is built into a larger application or has its own security model.UndefinedThere is no execution policy set in the current scope. If the execution policy in all scopes is Undefined, the effective execution policy is Restricted for Windows clients and RemoteSigned for Windows Server.DefaultSets the default execution policy. For Windows clients and servers, this is RemoteSigned.

Important Notes​


Execution Policy Scopes​

Execution policies can be applied at multiple scopes. The final effective policy is determined by precedence.

ScopeDescriptionPrecedenceMachinePolicySet by Group Policy for all users of the computer.HighestUserPolicySet by Group Policy for the current user of the computer.2ndProcessAffects only the current PowerShell session.3rdCurrentUserAffects the logged-in user.4thLocalMachineAffects all users on the system.Lowest

Group Policy overrides all local settings. When MachinePolicy or UserPolicy is set via Group Policy, any local Set-ExecutionPolicy command will either fail or be silently ignored.


Viewing and Setting Execution Policies​

View the Effective Policy​


Get-ExecutionPolicy

Code explanation: Returns the effective execution policy for the current session. This is the policy that actually applies, considering all scopes and their precedence.

View All Scopes​


Get-ExecutionPolicy -List

Code explanation: Displays the execution policy for each scope in the order of precedence, showing MachinePolicy, UserPolicy, Process, CurrentUser, and LocalMachine.

Set a Policy for the Current User​


Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Code explanation: Sets the execution policy to RemoteSigned for the current user only. Does not require administrative privileges.

Set a Policy for the Local Machine​


Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine

Code explanation: Sets the execution policy for everyone who uses the computer. Requires running PowerShell with Run as Administrator.

Set a Policy for the Current Process Only​


Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process

Code explanation: Sets the execution policy to Bypass for the current session only. The policy is stored only in memory and is lost when the session closes. This is commonly used in automation pipelines where temporary relaxation is required.

Using the ExecutionPolicy Parameter with pwsh.exe​

You can also set an execution policy for a new PowerShell session using the -ExecutionPolicy parameter:


pwsh.exe -ExecutionPolicy Bypass -File .\script.ps1

Code explanation: Launches a new PowerShell session with the Bypass execution policy for that session only. This is ideal for automation scripts that need to run without policy restrictions.


Enterprise Use Cases​

AllSigned for High-Security Environments​

RemoteSigned for Standard Enterprise Environments​

Bypass for Automation Systems​


Script Signing and Trusted Publishers​

When using AllSigned or RemoteSigned, organizations typically:

Signing a Script​


$cert = Get-ChildItem -Path Cert:\CurrentUser\My -CodeSigningCert

Set-AuthenticodeSignature -FilePath .\script.ps1 -Certificate $cert

Code explanation: Retrieves a code-signing certificate from the Current User certificate store and signs the specified script.

Signed scripts provide:

Managing Trusted Publishers​

When you run a signed script from a publisher you haven't yet classified as trusted or untrusted, PowerShell prompts you to make a decision. You can manage trusted publishers through the certificate store.


Execution Policy Conflicts and Troubleshooting​

Group Policy Override​

When Group Policy sets MachinePolicy or UserPolicy, local execution policy changes are overridden. PowerShell displays a message:


PowerShell updated your local preference successfully, but the setting is overridden by the Group Policy applied to your system.

Code explanation: The local policy is written to the registry but has no effect because Group Policy takes precedence.

Determining Group Policy Control​

To determine if your execution policy is controlled by Group Policy:


Get-ExecutionPolicy -List

If MachinePolicy or UserPolicy shows a value other than Undefined, Group Policy is in effect.

Forcing a Policy Change​

The -Force parameter can be used to suppress confirmation prompts:


Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Force

Code explanation: Sets the execution policy without prompting for confirmation. Useful in automation scripts.


Best Practices for Enterprise Environments​


Summary​

Execution policies provide a governance layer that helps organizations control script execution and enforce compliance requirements. Key concepts include:

Execution policies form the foundation of secure PowerShell usage in enterprise environments, ensuring that automation remains controlled, auditable, and compliant.

Found this helpful? Share the knowledge...

... or support this project to keep it alive!

Buy Me a Coffee

Previous

Security and Compliance

Next

Code Signing