PowerShell Execution Policy

PowerShell security settings - Complete guide to execution policies, script security, and proper PowerShell management.

About PowerShell Execution Policy

PowerShell Execution Policy is a security feature that controls the conditions under which PowerShell loads configuration files and runs scripts.

  • Prevents accidental script execution and provides basic protection against malicious scripts
  • Not a security boundary - determined users can bypass policies
  • Essential for automation, system administration, and script deployment

Policy Management Commands

View Current Policy
Get-ExecutionPolicy
Shows the current execution policy
Get-ExecutionPolicy -List
Shows all scope policies
Set Policy
Set-ExecutionPolicy RemoteSigned
Sets policy for current user
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
Sets policy with specific scope
Restrictive Policies
Restricted

Default on Windows clients

No scripts allowed to run

Individual commands only
AllSigned

High security

All scripts must be digitally signed

Requires trusted publisher
Permissive Policies
RemoteSigned

Most common setting

Local scripts run, remote scripts need signature

Balances security and usability
Unrestricted

Low security

All scripts run with warning for downloaded scripts

Use with caution

Complete Execution Policy Reference

PolicySecurity LevelLocal ScriptsRemote ScriptsUse Case
RestrictedHighest❌ Blocked❌ BlockedDefault Windows client setting
AllSignedHigh✅ If signed✅ If signedHigh-security environments
RemoteSignedMedium✅ Allowed✅ If signedMost common production setting
UnrestrictedLow✅ Allowed⚠️ With warningDevelopment/testing environments
BypassNone✅ Allowed✅ AllowedEmbedded scripts, applications
UndefinedVariableNo policy set - inherits from higher scopeRemoves current scope setting
Policy Scopes (in precedence order):
  1. MachinePolicy - Set by Group Policy for computer
  2. UserPolicy - Set by Group Policy for user
  3. Process - Affects current PowerShell process only
  4. CurrentUser - Affects current user only
  1. LocalMachine - Affects all users on computer
Note: Higher numbered scopes take precedence. Group Policy settings cannot be overridden.