The "cannot be loaded because running scripts is disabled on this system" error means PowerShell's execution policy is set to Restricted, AllSigned, or RemoteSigned and is blocking a .ps1 file from running. You fix it by setting the policy to RemoteSigned or Unrestricted for the scope that actually applies β€” CurrentUser for your own account, LocalMachine for everyone β€” then opening a fresh PowerShell window so the change registers. On a work machine, the policy may be locked by Group Policy, in which case the command-line fix will appear to succeed and then quietly fail.

That's the whole answer in one paragraph. Everything below is the detail that determines whether the fix holds after a reboot, survives a domain refresh, or gets reverted the moment your IT department pushes policy.

Why Set-ExecutionPolicy Fails With "Access to the Registry Key Is Denied"

Execution policy lives in the Windows registry, and the location it reads from depends on the scope you target. CurrentUser writes to HKEY_CURRENT_USER\Software\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell. LocalMachine writes to the same path under HKEY_LOCAL_MACHINE. A standard user account can write the first and cannot write the second without elevation.

Microsoft's own documentation describes five policy scopes β€” Process, CurrentUser, LocalMachine, and two Group Policy scopes β€” and states that policies apply in a precedence order with MachinePolicy and UserPolicy at the top, LocalMachine below those, CurrentUser below that, and Process at the bottom. When a higher-precedence scope conflicts with a lower one, the higher one wins. That hierarchy is why a correctly typed Set-ExecutionPolicy RemoteSigned -Scope CurrentUser can succeed and still leave scripts blocked: a domain policy at the MachinePolicy scope overrides it.

The current effective policy is readable without any elevation. Running Get-ExecutionPolicy -List returns all five scopes and their values in a table. That single command tells you which scope is actually blocking you, and it's the first thing to run before changing anything.

Step-by-Step: The Execution Policy Fix in the Right Order

Work through these in sequence. Each step tells you whether to continue or stop.

1: Open PowerShell as your normal user (not elevated) and run Get-ExecutionPolicy -List. Read the highest-precedence scope that shows a restrictive value. 2: If MachinePolicy or UserPolicy shows Restricted, AllSigned, or Undefined with a restrictive Group Policy object behind it, stop β€” the registry fix won't hold. Contact your administrator. 3: If CurrentUser shows Restricted, run Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned and confirm with Y. 4: If LocalMachine needs changing for all users, open PowerShell as Administrator and run the same command with -Scope LocalMachine. Expect a UAC prompt. 5: Close every PowerShell window and open a new one β€” the policy is read at process start. 6: Verify with Get-ExecutionPolicy -List again and confirm the scope you changed now reads RemoteSigned. 7: Run your script. If it fails with a signature error rather than a policy error, the policy is fixed and the problem is now file signing.

If step 3 throws "Access to the registry key ... is denied," you're either not the owner of the CurrentUser hive (unusual) or a policy has locked the key's permissions. In the second case, elevation won't help β€” only the administrator who set the lock can release it.

How to Tell RemoteSigned From Unrestricted Before You Pick One

RemoteSigned and Unrestricted both allow local scripts to run, and they behave differently the moment a file carries a downloaded-file marker. Windows tags files downloaded through a browser or email client with a zone identifier in an alternate data stream. RemoteSigned refuses to run any tagged script that isn't digitally signed; Unrestricted runs it anyway. That difference is the entire security argument.

Policy Local scripts Downloaded scripts Registry scope it writes Who should pick it
Restricted (default on client Windows) Blocked Blocked n/a β€” this is the default Nobody who needs to run scripts
RemoteSigned Run Only if signed CurrentUser or LocalMachine Most developers and administrators
Unrestricted Run Run, with a warning prompt first CurrentUser or LocalMachine Isolated test machines only
AllSigned Only if signed Only if signed CurrentUser or LocalMachine High-control production servers
Bypass Run Run Process only, never persistent Single automation sessions

Microsoft's about_Execution_Policies reference lists Restricted as the default on Windows client operating systems and RemoteSigned as the default on Windows Server. That split matters if you're troubleshooting a server and assuming it behaves like your laptop.

Unrestricted is the wrong default for a reason worth stating plainly: the policy is a safety rail against accidentally executing a script you didn't intend to, and removing it entirely means a stray double-click on a downloaded .ps1 runs code with your full user rights. RemoteSigned keeps the rail for files that crossed a network boundary while letting you write and run your own scripts locally.

The Temporary Fix: -ExecutionPolicy Bypass and When It's the Right Call

powershell.exe -ExecutionPolicy Bypass -File .\script.ps1 runs a single script with no policy check at all, and it changes nothing on disk. The policy applies to that process only and disappears when the window closes. For a one-off script on a machine you don't administer, this is often the cleanest option.

The same effect comes from the session-scoped switch: Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass inside a running window. Microsoft documents Process as the least persistent scope β€” it lasts only for the current PowerShell session. Nothing to clean up, nothing to revert, no registry write.

The catch is that Bypass also silences the warning prompts, so a downloaded script runs without the "do you want to run this" pause. Use it for scripts you've read. The other catch: some endpoint detection products flag -ExecutionPolicy Bypass on the command line as a suspicious pattern, because it's a common move in malicious script delivery. If your security team alerts on it, the persistent RemoteSigned route is quieter.

One more failure mode worth knowing: -ExecutionPolicy Bypass passed as a parameter to powershell.exe works, but the same text placed after the script path is treated as a script argument and silently does nothing. Position matters.

When Group Policy Owns the Setting and Local Commands Do Nothing

If Get-ExecutionPolicy -List shows MachinePolicy or UserPolicy set to a restrictive value, that value came from a Group Policy Object, and no local command overrides it. Microsoft's documentation is explicit that the two Group Policy scopes take precedence over everything else. You can run Set-ExecutionPolicy fifty times; the next policy refresh reverts it.

The Group Policy setting lives under Computer Configuration β†’ Administrative Templates β†’ Windows Components β†’ Windows PowerShell β†’ Turn on Script Execution. An administrator sets it to Allow only signed scripts, Allow local scripts and remote signed scripts, or Allow all scripts, and the setting reaches machines through the normal gpupdate cycle. The registry path under HKLM\Software\Policies is also typically ACL-locked so that even local administrators can't edit it directly.

What to do: capture the output of Get-ExecutionPolicy -List and send it to your IT team with the exact script you're trying to run and why. That's a five-minute request on their side and a guaranteed dead end on yours. If you need to keep working in the meantime, the Process-scope Bypass from the previous section still works unless the policy specifically blocks it β€” verify by trying it, don't assume.

Intune and Endpoint Manager Deployments: Where the Policy Actually Comes From

In organizations managed through Microsoft Intune, execution policy is usually pushed as a PowerShell script or a Settings Catalog profile rather than a classic GPO. The Settings Catalog exposes the same "Turn on Script Execution" control under Administrative Templates, and the values map one-to-one to the GPO options. The result on the endpoint is identical: MachinePolicy shows the pushed value and local changes don't stick.

The practical difference is timing. Intune policy typically applies at check-in, which can be up to eight hours by default for some assignment types, though a manual sync from Company Portal or the Intune Management Extension forces it sooner. If a user reports the error reappearing "randomly," an Intune-delivered policy landing after their local fix is a common explanation.

There's a version-specific wrinkle worth flagging: PowerShell 7 runs as a separate executable (pwsh.exe) and reads execution policy from its own configuration path, not the Windows PowerShell 5.1 registry keys. A machine can show RemoteSigned in Windows PowerShell and Restricted in PowerShell 7, or vice versa. Check which shell the failing script actually launches under before you change anything β€” running $PSVersionTable.PSVersion at the prompt settles it in one line.

What to Do When RemoteSigned Is Set but the Script Still Won't Run

The error message text is the tell. A policy block reads "cannot be loaded because running scripts is disabled on this system." A signature problem reads something like "the file is not digitally signed" or "the hash of the file does not match." They look similar in a console window and mean completely different things.

If RemoteSigned is confirmed active and a downloaded script still fails, the file carries a zone identifier. Clearing it takes one command: Unblock-File -Path .\script.ps1. That strips the alternate data stream marking the file as remote, after which RemoteSigned treats it as local and runs it. This is the single most common "the policy is fixed but the script still won't run" scenario, and it accounts for a large share of confused forum threads on the topic.

A second edge case: scripts launched from a network share (a UNC path like \server\share\script.ps1) are treated as remote regardless of local policy when the policy is RemoteSigned. Copying the file local and running it there avoids the issue entirely.

A third: some scripts are invoked not by you but by a scheduled task or a service running under a different account. That account has its own CurrentUser hive. Setting the policy for your logged-in user does nothing for a service account, and the fix has to be applied at LocalMachine scope or under that account's profile.

Scope Precedence, in Plain Terms

Think of it as a stack. The Process scope sits at the bottom and applies only to the current window. CurrentUser sits above it, LocalMachine above that, UserPolicy above that, and MachinePolicy at the top. The highest scope with a defined value wins, and "Undefined" at a higher scope simply passes the decision down.

That's why the order of operations in a fix matters. Setting LocalMachine to Unrestricted while MachinePolicy says AllSigned accomplishes nothing β€” the top of the stack still controls. It's also why an administrator can hand a user a working Set-ExecutionPolicy command that fails on the user's machine: the command targets a scope the user can write, but a higher scope is overriding it.

Precedence also explains why a policy change can appear to take effect and then stop working after a reboot. If the change was made at Process scope, it never persisted. If it was made at CurrentUser but a policy refresh landed afterward, the refresh wins. Microsoft's documentation on scope precedence is the authoritative reference here, and it's worth reading once rather than guessing.

Execution Policy Is Not a Security Boundary, and Treating It as One Backfires

Microsoft has stated repeatedly that execution policy is a safety feature, not a security control β€” a determined user can bypass it in several documented ways, several of which are built into the product. That's not a flaw; it's the design. The policy exists to prevent accidental execution, not to stop a motivated attacker.

The practical consequence is that organizations sometimes demand a locked-down policy expecting security benefits that don't materialize, while the actual friction lands on developers and administrators trying to do legitimate work. The result is often a workaround culture β€” people memorizing Bypass flags β€” which is worse than a sensible RemoteSigned baseline.

For an individual on their own machine, the judgment call is straightforward: RemoteSigned at CurrentUser scope gives you working scripts and keeps a rail on downloaded files. For a managed machine, the honest answer is that the policy isn't yours to set, and the fastest path is a ticket with the Get-ExecutionPolicy -List output attached. A technician who arrives with that screenshot gets resolution in one round trip instead of three.

FAQ

Does changing the execution policy require administrator rights?

Only for LocalMachine scope. CurrentUser writes to your own registry hive and works from a standard user account, which is why Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned is the recommended first attempt. If that command reports access denied, the key permissions have been locked by policy and elevation won't fix it.

Will this error come back after I restart my computer?

It won't if the change was made at CurrentUser or LocalMachine scope and no policy overrides it. It will if the change was made at Process scope, which evaporates when the window closes, or if a Group Policy object refreshes the MachinePolicy value afterward. Re-run Get-ExecutionPolicy -List after a reboot to confirm which situation you're in.

Is Unrestricted or Bypass less safe than RemoteSigned?

Yes, and the gap is bigger than it looks. Bypass skips every check and every warning, including for files downloaded from the internet. RemoteSigned runs your local scripts freely but refuses unsigned files that carry a remote-origin marker, which is exactly the category most likely to be malicious if it arrived unexpectedly.

Why does my script work in one PowerShell window but not another?

Two windows can be running different PowerShell versions, and PowerShell 7 reads its execution policy from a separate configuration path from Windows PowerShell 5.1. A machine can show one policy in each shell. Run $PSVersionTable.PSVersion in both windows to confirm you're comparing like with like before changing settings.

Does this error affect .bat and .cmd files?

No. Execution policy governs PowerShell script files (.ps1) and module files (.psm1). Batch files run under cmd.exe and never consult the PowerShell policy. If a .bat file fails, the cause is something else β€” file permissions, a blocked path, or antivirus quarantine.

Can I set the policy for every user on a shared machine?

Yes, at LocalMachine scope from an elevated prompt, and it applies to all accounts on that computer. The caveat is that a per-user Group Policy at UserPolicy scope still outranks it for each individual, so check Get-ExecutionPolicy -List under the affected account rather than assuming the machine-wide setting governs.

What's the fastest way to run one script without changing anything permanent?

Launch it with powershell.exe -ExecutionPolicy Bypass -File .\script.ps1, keeping the flag before the -File argument. Nothing is written to the registry, the setting dies with the process, and the change can't affect anything else on the machine. Just confirm the script is one you trust before running it this way.