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.
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 : UnauthorizedAccessThe 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.
- MachinePolicy, UserPolicyset by Group Policyif not set
- Processthis session onlyif not set
- CurrentUseryour accountif not set
- LocalMachineeveryone on this PCif not set
- Default: Restrictedscripts cannot run(breaks here)
TL;DR
Get-ExecutionPolicy -List # who sets whatSet-ExecutionPolicy -Scope CurrentUser RemoteSigned # the usual fix: no admin neededUnblock-File .\deploy.ps1 # a script you downloaded and trust1. See what is set, and where
There isn’t one execution policy but five scopes, and the most specific one that is set wins:
Get-ExecutionPolicy -List Scope ExecutionPolicy ----- ---------------MachinePolicy Undefined UserPolicy Undefined Process Undefined CurrentUser Undefined LocalMachine UndefinedThey 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
Set-ExecutionPolicy -Scope CurrentUser RemoteSignedRemoteSigned 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:
Set-ExecutionPolicy -Scope LocalMachine RemoteSigned3. 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:
Set-ExecutionPolicy -Scope Process BypassOr for one script, which is the usual form in scheduled tasks and installers:
powershell.exe -ExecutionPolicy Bypass -File C:\scripts\deploy.ps1Note
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:
Unblock-File -Path C:\Users\me\Downloads\setup.ps15. “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.