PowerShell: running scripts is disabled on this system (PSSecurityException)
Windows 10 / 11, PowerShell 5.1 & PowerShell 7 (pwsh), VS Code Integrated Terminal
File C:\repo\setup.ps1 cannot be loaded because running scripts is disabled on this system. UnauthorizedAccess / PSSecurityException.
What it means (root cause)
Windows defaults the CurrentUser/LocalMachine PowerShell ExecutionPolicy to Restricted on client SKUs, blocking unsigned local .ps1 scripts and npm/pnpm global shims.
The symptom developers actually see: File C:\repo\setup.ps1 cannot be loaded because running scripts is disabled on this system. UnauthorizedAccess / PSSecurityException.
Step-by-step fix
Concrete, ordered steps from the dataset. Apply them in order; each line is a verified action, not generic advice.
- 1Check effective scopes first: Get-ExecutionPolicy -List
- 2Unblock only your current user profile without disabling enterprise GPOs: Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned -Force
- 3For one-off CI or automation runs without modifying policy: powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\setup.ps1
- 4If downloaded from the internet, strip the Zone.Identifier alternate data stream: Unblock-File -Path .\setup.ps1
Where this error appears
Languages, frameworks, and runtimes where this error is observed (from the 2026 DevFixPro error dataset, retrieved 2026-08-29):
Hits Windows developers immediately after installing Node.js, yarn, or Python venv activate.ps1 scripts.
How to prevent it & common questions
Practical prevention plus the questions developers ask most about this error.
What does "PowerShell: running scripts is disabled on this system (PSSecurityException)" mean?
Windows defaults the CurrentUser/LocalMachine PowerShell ExecutionPolicy to Restricted on client SKUs, blocking unsigned local .ps1 scripts and npm/pnpm global shims.
Which environments are affected by PowerShell: running scripts is disabled on this system (PSSecurityException)?
Windows 10 / 11, PowerShell 5.1 & PowerShell 7 (pwsh), VS Code Integrated Terminal
How do I fix PowerShell: running scripts is disabled on this system (PSSecurityException)?
Check effective scopes first: Get-ExecutionPolicy -List Unblock only your current user profile without disabling enterprise GPOs: Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned -Force For one-off CI or automation runs without modifying policy: powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\setup.ps1 If downloaded from the internet, strip the Zone.Identifier alternate data stream: Unblock-File -Path .\setup.ps1
How do I prevent PowerShell: running scripts is disabled on this system (PSSecurityException)?
Sign internal ops scripts with an enterprise code-signing certificate or use RemoteSigned at CurrentUser scope rather than Unrestricted.
Related DevFixPro tools
No dedicated DevFixPro tool maps to this error yet. Browse the full client-side toolkit instead: all developer tools →
Sources & attribution
- Error records aggregated from Google Search Console query gaps (2026-05-21~2026-08-18) for devfixpro.com, plus official framework docs (MDN, Node.js docs, Python docs, Go.dev, Rust book, Oracle Java docs, Docker docs, npm docs). Source dataset retrieved 2026-08-29. License: CC BY 4.0 — attribute DevFixPro (devfixpro.com).
- Official reference: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies
- All cause, environment, fix and prevention text on this page is taken verbatim from the DevFixPro 2026 error dataset. DevFixPro does not invent root causes or fixes.
How this PowerShell: running scripts is disabled on this system (PSSecurityException) page is built
Each error page is generated from a single record in the DevFixPro 2026 error dataset. The meaning, root cause, environments, fix steps, prevention, and official references are copied verbatim from that dataset and its official-doc sources; related-error links are computed from the error's category and explicit peer list. No root cause or fix is invented. The retrieval date for this dataset is 2026-08-29.