Updating Codex in PowerShell 7 always reports an error
Open 💬 5 comments Opened Jul 18, 2026 by siri666666
💡 Likely answer: A maintainer (github-actions[bot], contributor)
responded on this thread — see the highlighted reply below.
What version of Codex CLI is running?
codex-cli 0.144.6
What subscription do you have?
无关
Which model were you using?
_No response_
What platform is your computer?
_No response_
What terminal emulator and version are you using (if applicable)?
_No response_
Codex doctor report
What issue are you seeing?
codex update
Updating Codex via powershell -ExecutionPolicy Bypass -c '$env:CODEX_NON_INTERACTIVE=1; irm https://chatgpt.com/codex/install.ps1 | iex'...
==> Updating Codex CLI from 0.144.5 to 0.144.6
==> Detected platform: Windows (x64)
==> Resolved version: 0.144.6
==> Downloading Codex CLI
iex : 无法将“Get-FileHash”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然
后再试一次。
所在位置 行:1 字符: 75
- ... EX_NON_INTERACTIVE=1; irm https://chatgpt.com/codex/install.ps1 | iex
- ~~~
- CategoryInfo : ObjectNotFound: (Get-FileHash:String) [Invoke-Expression], CommandNotFoundException
- FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.InvokeExpressionCommand
Error: powershell -ExecutionPolicy Bypass -c '$env:CODEX_NON_INTERACTIVE=1; irm https://chatgpt.com/codex/install.ps1 | iex' failed with status exit code: 1
What steps can reproduce the bug?
codex update
What is the expected behavior?
_No response_
Additional information
_No response_
5 Comments
English translation:
What version of Codex CLI is running?
codex-cli 0.144.6
What subscription do you have?
Irrelevant
Which model were you using?
_No response_
What platform is your computer?
_No response_
What terminal emulator and version are you using (if applicable)?
_No response_
Codex doctor report
What issue are you seeing?
codex update
Updating Codex via
powershell -ExecutionPolicy Bypass -c '$env:CODEX_NON_INTERACTIVE=1; irm https://chatgpt.com/codex/install.ps1 | iex'...==> Updating Codex CLI from 0.144.5 to 0.144.6
==> Detected platform: Windows (x64)
==> Resolved version: 0.144.6
==> Downloading Codex CLI
iex: The term “Get-FileHash” is not recognized as the name of a cmdlet, function, script file, or executable program. Check the spelling of the name, and if a path was included, make sure the path is correct, then try again.
At line:1 char:75
Error:
powershell -ExecutionPolicy Bypass -c '$env:CODEX_NON_INTERACTIVE=1; irm https://chatgpt.com/codex/install.ps1 | iex'failed with status exit code: 1What steps can reproduce the bug?
codex update
What is the expected behavior?
_No response_
Additional information
_No response_
<!-- codex-issue-translator -->
A workaround for this is just updating codex through Command Prompt (a.k.a CMD) instead of through pwsh, then it works just fine. Just open cmd.exe and type
codex update.I have the same issue. Here is the summary from codex:
Windows updater fails because
Get-FileHashis unavailableAttempting to update Codex CLI from
0.144.5to0.145.0on Windows x64 fails during checksum verification.Command invoked by Codex:
```powershell
powershell -ExecutionPolicy Bypass -c '$env:CODEX_NON_INTERACTIVE=1; irm https://chatgpt.com/codex/install.ps1 | iex'
Output:
==> Updating Codex CLI from 0.144.5 to 0.145.0
==> Detected platform: Windows (x64)
==> Resolved version: 0.145.0
==> Downloading Codex CLI
iex : The term 'Get-FileHash' is not recognized...
CategoryInfo : ObjectNotFound: (Get-FileHash:String) [Invoke-Expression], CommandNotFoundException
FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.InvokeExpressionCommand
Error:
powershell ...failed with status exit code: 1Environment:
discovery/PSModulePath.
The installer calls Get-FileHash in Test-ArchiveDigest:
https://releases.openai.com/codex/install.ps1
Potential workaround:
pwsh -NoProfile -ExecutionPolicy Bypass -Command 'Import-Module Microsoft.PowerShell.Utility; $env:CODEX_NON_INTERACTIVE=1; irm
https://chatgpt.com/codex/install.ps1 | iex'
The installer should either invoke a PowerShell host where Get-FileHash is available, explicitly import Microsoft.PowerShell.Utility, or
use a hashing fallback.
confirmed this works.
Same root cause as #27117 — this is not specific to your machine. When
codex updateruns from PowerShell 7, the spawnedpowershell.exe(Windows PowerShell 5.1) inherits pwsh'sPSModulePath, resolves the Core-only build ofMicrosoft.PowerShell.Utility, andGet-FileHashbecomes unavailable at the checksum step. Full analysis and reproductions are collected in #27117.I keep a patch-ready fix rebased against current
main— it removes theGet-FileHashdependency frominstall.ps1by hashing via .NET, with a regression test that passes under both Windows PowerShell 5.1 and PowerShell 7: main...snowyukitty:fix/windows-installer-dotnet-sha256, also viewable as a reviewable PR on my fork: snowyukitty/codex#2.Workarounds until it's fixed upstream:
codex updatefrom cmd.exe or Windows PowerShell 5.1, or$env:CODEX_NON_INTERACTIVE=1; irm https://chatgpt.com/codex/install.ps1 | iexIf you're affected, consider also adding a 👍 on #27117 so the reports are consolidated in one place for triage.