Since 2016 · 50,000+ customers · ★ 5.0 on Google Live chatWhatsAppTelegramOpen a ticket
Get started
Windows Server

How to Bypass the PowerShell Execution Policy Temporarily

How to bypass the PowerShell execution policy guide by 99RDP

You download or write a PowerShell script, run it, and get: "File cannot be loaded because running scripts is disabled on this system." That's the execution policy. On Windows client editions the default is Restricted, which blocks all scripts. You can bypass it for a single run or a single session without lowering security for the whole machine. This guide shows how, explains each policy and scope, and covers the safer long-term setting.

Quick answerBypass it only for the current PowerShell window:

Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process

Or run one script with the policy bypassed:

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

Neither command changes the machine's saved policy, and neither needs administrator rights.

PowerShell execution policies: Restricted, AllSigned, RemoteSigned, Unrestricted and Bypass
Execution policies

What the execution policy is (and isn't)

The execution policy decides whether PowerShell loads configuration files and runs scripts. It's a safety feature to stop you running scripts by accident, not a security boundary: anyone can paste a script's contents into the console. Microsoft describes it that way too. So bypassing it for a script you trust is normal admin work; just don't bypass it for scripts you haven't read.

The execution policies

PolicyWhat it does
RestrictedNo scripts at all. Default on Windows 10 and 11.
AllSignedOnly scripts signed by a trusted publisher.
RemoteSignedLocal scripts run; downloaded scripts must be signed or unblocked. Default on Windows Server.
UnrestrictedEverything runs; warns before running downloaded scripts. Default on non-Windows PowerShell 7.
BypassNothing is blocked and there are no warnings.
UndefinedNo policy set in this scope.
PowerShell execution policy scopes from strongest to weakest: MachinePolicy, UserPolicy, Process, CurrentUser, LocalMachine
Which scope wins

Method 1: Bypass for the current session

Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process
.\script.ps1

The Process scope lives only as long as this PowerShell window. Close it and the normal policy is back. Answer Y if PowerShell asks to confirm, or add -Force.

Method 2: Bypass for one script

Start a new PowerShell process with the policy set on the command line, which is ideal for shortcuts, batch files and scheduled tasks:

powershell.exe -NoProfile -ExecutionPolicy Bypass -File "C:\Scripts\backup.ps1"

# PowerShell 7
pwsh.exe -NoProfile -ExecutionPolicy Bypass -File "C:\Scripts\backup.ps1"

In Task Scheduler, put powershell.exe in Program/script and -NoProfile -ExecutionPolicy Bypass -File "C:\Scripts\backup.ps1" in Add arguments.

Ways to run a downloaded PowerShell script safely: read it, then Unblock-File, or Bypass for one session
Running a downloaded script

Method 3: Unblock a downloaded script

If the policy is RemoteSigned and the script came from the internet, Windows marks it with a "Mark of the Web". After you've checked the script, remove that mark instead of bypassing the policy:

Unblock-File -Path .\script.ps1
# or for a whole folder
Get-ChildItem C:\Scripts -Recurse | Unblock-File

You can also right-click the file → Properties → tick Unblock.

The safer permanent setting: RemoteSigned for your user

If you run your own scripts every day, set RemoteSigned for your account only. It doesn't need admin rights and doesn't affect other users:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Avoid setting Unrestricted or Bypass permanently for LocalMachine; it removes the warning for every script, including ones that arrive by email or download.

Check the current policy and scopes

Get-ExecutionPolicy                # effective policy
Get-ExecutionPolicy -List          # every scope

Scopes are applied in this order, and the first one that isn't Undefined wins:

  1. MachinePolicy (Group Policy for the computer)
  2. UserPolicy (Group Policy for the user)
  3. Process
  4. CurrentUser
  5. LocalMachine

Troubleshooting

  • "Windows PowerShell updated your execution policy successfully, but the setting is overridden by a policy defined at a more specific scope": Group Policy sets MachinePolicy or UserPolicy. Use the -ExecutionPolicy Bypass command-line method, or ask your admin to change the GPO.
  • Script still blocked in PowerShell 7: Windows PowerShell 5.1 and PowerShell 7 have separate settings. Set the policy in pwsh too.
  • "Access to the registry key is denied": you tried to change LocalMachine without admin rights. Use -Scope CurrentUser or -Scope Process.

Frequently asked questions

How do I bypass the execution policy in PowerShell?

Run Set-ExecutionPolicy Bypass -Scope Process for the current window, or powershell -ExecutionPolicy Bypass -File script.ps1 for one script.

Does -ExecutionPolicy Bypass need administrator rights?

No. The Process scope and the command-line switch work as a normal user. Only changing the LocalMachine scope needs admin rights.

Is Set-ExecutionPolicy Unrestricted safe?

It allows almost any script to run. RemoteSigned for the current user is the better everyday setting.

How do I reset the execution policy to default?

Run Set-ExecutionPolicy -ExecutionPolicy Undefined -Scope CurrentUser (and for LocalMachine as admin). Windows then uses its built-in default.

Minakshi, Server Administrator L1 at 99RDP
Written byMinakshiServer Administrator L1, 99RDP. Part of the team that runs our servers and answers support.
Keep reading

More Windows Server guides

All Windows Server guides

Need a server for this?

✓ Setup in minutes✓ Full admin access✓ 7-day refund on new services