How to Configure PowerShell Script Execution Policies in Windows 11

Automating administrative tasks, software deployments, and system diagnostics in Windows 11 relies extensively on PowerShell scripts (.ps1). However, by default, client installations of Windows configure PowerShell with restrictive execution policies that block scripts from running. This security control is designed to prevent non-technical users from accidentally executing malicious scripts downloaded from the web. Understanding how to manage execution policies, configure scoped permissions, and sign scripts ensures productive administrative automation without opening workstations to script-based attacks.

Understanding PowerShell Execution Policy Levels

A common misconception is that the PowerShell Execution Policy is a rigid security boundary like a firewall or AppLocker rule. In reality, it is a user safety mechanism designed to prevent inadvertent script execution. The primary policy levels include:

  • Restricted: Default on Windows 11 client editions. Permits individual interactive commands, but blocks all script files (.ps1, .psm1, .ps1xml) from running.
  • AllSigned: Only scripts digitally signed by a trusted publisher (verified via certificate) are allowed to run. Unsigned local scripts are blocked.
  • RemoteSigned: Local scripts authored on the workstation run without restriction. Scripts downloaded from the internet or email must be signed by a trusted publisher, or unblocked explicitly.
  • Unrestricted: Runs all scripts. Displays a warning prompt before executing scripts downloaded from remote locations.
  • Bypass: Nothing is blocked; no warnings or prompts are displayed. Commonly utilized in automated CI/CD deployment agents.

Understanding Execution Policy Scopes

PowerShell evaluates execution policies across multiple hierarchical scopes, prioritized in the following order:

  1. MachinePolicy: Enforced domain-wide via Group Policy for all computer users.
  2. UserPolicy: Enforced via Group Policy for the current user account.
  3. Process: Applies exclusively to the active PowerShell console session; discarded upon closing.
  4. CurrentUser: Applies to the logged-in user profile in the Windows Registry.
  5. LocalMachine: Applies to all local workstation accounts in the registry (requires Administrator elevation).

Auditing Active Policies via PowerShell

To inspect which policy is active across each scope on your system, launch PowerShell and run:

Get-ExecutionPolicy -List

PowerShell returns a precedence table:

        Scope ExecutionPolicy
        ----- ---------------
MachinePolicy       Undefined
   UserPolicy       Undefined
      Process       Undefined
  CurrentUser       Undefined
 LocalMachine      Restricted

The highest defined scope in the hierarchy determines the active effective policy.

Setting Execution Policy to RemoteSigned

For administrative workstations and developer machines, RemoteSigned represents the recommended security baseline. To apply this policy for the current user without requiring Administrator elevation:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

When prompted to confirm the execution policy change, press Y and hit Enter.

Applying Globally for All Machine Users

To configure RemoteSigned machine-wide across all local accounts, open PowerShell as Administrator and run:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine -Force

Running Scripts Safely in Process Scope

If you need to execute an administrative deployment script in a locked-down environment without permanently altering system-wide registry policies, apply the policy strictly to the active console process:

Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force

Once you close the PowerShell window, the process policy terminates, leaving the host system safely protected under its original baseline.

Unblocking Downloaded Scripts (Zone.Identifier)

When you download a .ps1 script from GitHub or an internal intranet server, Windows attaches an NTFS Alternate Data Stream known as the “Mark of the Web” (Zone.Identifier). Under RemoteSigned, PowerShell will refuse to execute the file until unblocked.

To inspect and unblock a downloaded script file via PowerShell:

# Inspect if the file carries the Mark of the Web
Get-Item -Path ".\deploy-script.ps1" -Stream "Zone.Identifier" -ErrorAction SilentlyContinue

# Unblock the script file safely
Unblock-File -Path ".\deploy-script.ps1"

Once unblocked, the script executes normally under the RemoteSigned policy.

Best Practice Enterprise Recommendations

  • Enforce via GPO: In Active Directory or Microsoft Entune environments, enforce Turn on Script Execution at the MachinePolicy level to prevent unauthorized local overrides.
  • Code Signing: For enterprise production scripts, sign scripts using an internal Public Key Infrastructure (PKI) code-signing certificate and enforce AllSigned across production servers.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.