- Courses
- đź’»Programming Languages
- 🪟PowerShell
- Enterprise-Grade PowerShell
- Security and Compliance
- Execution Policies
On this page
PowerShell Execution Policies: Complete Guide
Updated on June 26, 2026
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:
- Prevent accidental execution of unsigned or unapproved scripts
- Enforce code-signing requirements
- Maintain consistent behavior across systems
- Support compliance frameworks that require script validation
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​
- AllSigned carries the risk of running signed but malicious scripts.
- RemoteSigned carries the risk of running unsigned scripts from sources other than the internet, as well as signed but malicious scripts.
- On systems that do not distinguish UNC paths from internet paths, scripts identified by a UNC path might not be permitted to run with the RemoteSigned execution policy.
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​
- Ensures all scripts are signed by a trusted publisher
- Enforces publisher trust and integrity validation
- Supports auditability and change control
- Blocks untrusted scripts entirely
- Ideal for regulated industries and compliance-sensitive environments
RemoteSigned for Standard Enterprise Environments​
- The default execution policy for Windows computers
- Prevents accidental execution of downloaded scripts
- Allows internal scripts to run without signing
- Balances security and usability
- Recommended for most enterprise environments
Bypass for Automation Systems​
- Used by CI/CD pipelines, configuration management agents, and deployment tools
- Avoids interactive prompts
- Should be applied only at the Process scope or using
-ExecutionPolicy Bypasswithpwsh.exe - Never set Bypass as the MachinePolicy or LocalMachine policy in production
Script Signing and Trusted Publishers​
When using AllSigned or RemoteSigned, organizations typically:
- Issue internal code-signing certificates
- Require developers to sign scripts before deployment
- Maintain trusted publisher lists
- Use version control to track script changes
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:
- Integrity validation (ensures the script hasn't been tampered with)
- Publisher verification (confirms the identity of the script author)
- Compliance with regulatory frameworks
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​
- Use Group Policy for centralized management — The "Turn on Script Execution" Group Policy setting overrides all local execution policies. Configure it under Computer Configuration → Administrative Templates → Windows Components → Windows PowerShell.
- Choose RemoteSigned as the default — It provides the best balance of security and usability for most enterprise environments.
- Use AllSigned for regulated environments — Enforces script signing and provides auditability.
- Never set Bypass permanently — Use it only at the Process scope or with
-ExecutionPolicy Bypassfor specific automation runs. - Implement script signing — Issue internal code-signing certificates and require signing before deployment.
- Regularly audit execution policies — Use
Get-ExecutionPolicy -Listto verify policies across scopes. - Test policy changes in non-production environments — Before deploying new policies broadly.
- Document policy decisions — Record the reasoning behind execution policy choices for compliance and audit purposes.
Summary​
Execution policies provide a governance layer that helps organizations control script execution and enforce compliance requirements. Key concepts include:
- Execution policies are a safety feature, not a security boundary
- Policies can be applied at multiple scopes with clear precedence: MachinePolicy > UserPolicy > Process > CurrentUser > LocalMachine
- Group Policy overrides all local settings
- Script signing is essential in secure environments
- RemoteSigned and AllSigned are common enterprise standards
- Use Bypass only for automation and only at the Process scope
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!
Previous
Security and Compliance
Next
Code Signing
-
What Execution Policies Do
-
Available Execution Policy Levels
- Important Notes
-
Execution Policy Scopes
-
Viewing and Setting Execution Policies
- View the Effective Policy
- View All Scopes
- Set a Policy for the Current User
- Set a Policy for the Local Machine
- Set a Policy for the Current Process Only
- Using the ExecutionPolicy Parameter with pwsh.exe
-
Enterprise Use Cases
- AllSigned for High-Security Environments
- RemoteSigned for Standard Enterprise Environments
- Bypass for Automation Systems
-
Script Signing and Trusted Publishers
- Signing a Script
- Managing Trusted Publishers
-
Execution Policy Conflicts and Troubleshooting
- Group Policy Override
- Determining Group Policy Control
- Forcing a Policy Change
-
Best Practices for Enterprise Environments
-
Summary
