Skip to content
ohsudo, Home
Windows

PowerShell "running scripts is disabled on this system": fix the execution policy safely

Fix PowerShell "cannot be loaded because running scripts is disabled": check the execution policy, use RemoteSigned for your user, and unblock downloaded scripts.

Beginner3 min readApplies to Windows 10 · Windows 11 · Windows Server 2016+ · Windows PowerShell 5.1 · PowerShell 7

by OhSudo ··

Checked on real software: Windows, PowerShell · November 2026How we check

You run a script, or a tool that is a script underneath, like npm or yarn, and PowerShell stops:

.\deploy.ps1 : File C:\scripts\deploy.ps1 cannot be loaded because running scripts is disabled on this system.
For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ .\deploy.ps1
+ ~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess

The script is fine. PowerShell’s execution policy says scripts may not run at all. Restricted is the default on Windows client editions; Windows Server defaults to RemoteSigned, so this error is much more common on a desktop.

  1. MachinePolicy, UserPolicyset by Group Policy
  2. Processthis session only
  3. CurrentUseryour account
  4. LocalMachineeveryone on this PC
  5. Default: Restrictedscripts cannot run(breaks here)
There are five execution policy scopes, and the most specific one that is set wins. Undefined everywhere means the default: Restricted on Windows client editions.

TL;DR

Terminal window
Get-ExecutionPolicy -List # who sets what
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned # the usual fix: no admin needed
Unblock-File .\deploy.ps1 # a script you downloaded and trust

1. See what is set, and where

There isn’t one execution policy but five scopes, and the most specific one that is set wins:

Terminal window
Get-ExecutionPolicy -List
Scope ExecutionPolicy
----- ---------------
MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser Undefined
LocalMachine Undefined

They are listed in order of priority. Undefined everywhere means the default applies, which is Restricted on a client.

2. The usual fix: RemoteSigned for your user

Terminal window
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned

RemoteSigned runs scripts you wrote locally, and asks for a signature on scripts downloaded from the internet. -Scope CurrentUser changes only your account, so it doesn’t need an administrator prompt. This also fixes npm.ps1 cannot be loaded, yarn.ps1 cannot be loaded and the same error from other tools installed as PowerShell scripts.

For a whole machine, from an elevated prompt:

Terminal window
Set-ExecutionPolicy -Scope LocalMachine RemoteSigned

3. Only this once: Process scope or -ExecutionPolicy

To leave the settings alone, change the policy just for the current window. It’s gone when you close it:

Terminal window
Set-ExecutionPolicy -Scope Process Bypass

Or for one script, which is the usual form in scheduled tasks and installers:

Terminal window
powershell.exe -ExecutionPolicy Bypass -File C:\scripts\deploy.ps1

Note

Use Bypass only for scripts you trust: it turns off the check and the warnings. Microsoft is explicit that the execution policy isn’t a security boundary, because anyone can get around it this way. It’s a safety net against running a script by accident. It doesn’t replace knowing what a script does.

4. “is not digitally signed” after you changed the policy

With RemoteSigned, a script you downloaded gives a different error:

File C:\Users\me\Downloads\setup.ps1 cannot be loaded. The file C:\Users\me\Downloads\setup.ps1 is not digitally signed.

Windows marked the file as coming from the internet. Read it first; if you trust it, remove the mark:

Terminal window
Unblock-File -Path C:\Users\me\Downloads\setup.ps1

5. “overridden by a policy defined at a more specific scope”

Set-ExecutionPolicy : Windows PowerShell updated your execution policy successfully, but the setting is overridden by a policy defined at a more specific scope.

Your setting was saved, but something with priority still wins. Get-ExecutionPolicy -List shows what. A value in MachinePolicy or UserPolicy comes from Group Policy, so on a company machine it’s your IT department’s decision. You can’t change it from PowerShell; ask them, or use a signed script.

6. PowerShell 7 has its own setting

Windows PowerShell 5.1 (powershell.exe) and PowerShell 7 (pwsh.exe) are separate programs, and setting the LocalMachine scope in one doesn’t change the other. If a fix “doesn’t work”, check which one you opened with $PSVersionTable.PSVersion. On Linux and macOS, execution policies don’t apply at all: there, it’s the file’s permissions that matter, see Permission denied when running a script.

Shell, we have a problem!

Similar, but different: The term '.\deploy.ps1' is not recognized means PowerShell didn’t find the file: check the path and the folder you’re in, and see that article. And a script that runs but then fails with Access is denied needs an elevated prompt, not a different execution policy. If Windows itself needs repairing, see DISM 0x800f081f.

Found this useful? Share it.

Found a mistake? Let us know at contact@ohsudo.com.

Articles

Related articles