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_

View original on GitHub ↗

5 Comments

github-actions[bot] contributor · 1 month ago

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

  • ... 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_

<!-- codex-issue-translator -->

RicardoDeGenova · 1 month ago

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.

drebbe-intrepid · 1 month ago

I have the same issue. Here is the summary from codex:

Windows updater fails because Get-FileHash is unavailable

Attempting to update Codex CLI from 0.144.5 to 0.145.0 on 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: 1

Environment:

  • Windows 10.0.26200, x64
  • Windows PowerShell 5.1.26100.8875
  • PowerShell Core 7.6.3
  • Get-FileHash is installed and resolves normally from Microsoft.PowerShell.Utility in both hosts.
  • A standalone powershell.exe → iex → Get-FileHash diagnostic also succeeds.
  • The failure therefore appears specific to the environment inherited by the updater-spawned PowerShell process, possibly module

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.

drebbe-intrepid · 1 month ago
❯ pwsh -NoProfile -ExecutionPolicy Bypass -Command 'Import-Module Microsoft.PowerShell.Utility; $env:CODEX_NON_INTERACTIVE="1"; Invoke-RestMethod -Uri "https://chatgpt.com/codex/install.ps1" | Invoke-Expression'
==> Updating Codex CLI from 0.144.5 to 0.145.0
==> Detected platform: Windows (x64)
==> Resolved version: 0.145.0
==> Downloading Codex CLI
==> C:\Users\drebbe\AppData\Local\Programs\OpenAI\Codex\bin is already on PATH.
==> Current PowerShell session: codex
==> Future PowerShell windows: open a new PowerShell window and run: codex
Codex CLI 0.145.0 installed successfully.
~ took 13s
❯

confirmed this works.

snowyukitty · 8 days ago

Same root cause as #27117 — this is not specific to your machine. When codex update runs from PowerShell 7, the spawned powershell.exe (Windows PowerShell 5.1) inherits pwsh's PSModulePath, resolves the Core-only build of Microsoft.PowerShell.Utility, and Get-FileHash becomes 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 the Get-FileHash dependency from install.ps1 by 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:

  • run codex update from cmd.exe or Windows PowerShell 5.1, or
  • run the installer directly from your pwsh session: $env:CODEX_NON_INTERACTIVE=1; irm https://chatgpt.com/codex/install.ps1 | iex

If you're affected, consider also adding a 👍 on #27117 so the reports are consolidated in one place for triage.