Fix "running scripts is disabled on this system" in Codex on Windows
This error comes from Windows PowerShell's execution policy, not from Codex. PowerShell blocks scripts such as npm.ps1 until you allow them. The common fix OpenAI documents is Set-ExecutionPolicy -ExecutionPolicy RemoteSigned. Read Microsoft's execution policy guide first, and consider applying it only to your user account.
The error message
npm.ps1 cannot be loaded because running scripts is disabled on this system.
Applies to: Windows, ChatGPT desktop app, Codex CLI, PowerShell
Why it happens
Windows PowerShell won’t run script files unless the execution policy allows it. The first time Codex, or you in the integrated terminal, runs a tool that ships as a .ps1 wrapper, such as npm, PowerShell refuses. It can also happen when Codex writes a PowerShell script for you.
Fix
Check your current policy:
Get-ExecutionPolicy -List
Allow local scripts and signed downloaded scripts for your user only:
OpenAI’s docs show the same command without -Scope, which applies the default scope. Limiting it to CurrentUser avoids changing the setting for everyone on the machine.
Restart the ChatGPT desktop app, or open a new terminal, and try again.
If it still fails
On managed computers, Group Policy can enforce a stricter policy that Set-ExecutionPolicy can’t change. Ask your IT team.
If you’d rather not change the policy, run Codex’s agent in WSL2, where PowerShell policies don’t apply.
Questions people ask
Is RemoteSigned safe?
It lets local scripts run and requires downloaded scripts to be signed. It's a common developer setting, but it is a security trade-off. On a work machine, check with IT first. Group Policy may override it anyway.
Why does the Codex installer command include -ExecutionPolicy ByPass?
The official install command runs one PowerShell process with ByPass so the installer can run without changing your system-wide policy.
Sources
We link to the official source for every instruction on this page. If anything here disagrees with them, trust the official source and tell us.