Codex native installation on Windows fails to update when "codex update" is called
Open 💬 9 comments Opened Jun 25, 2026 by hi-fox
What version of Codex CLI is running?
0.142
What subscription do you have?
Pro
Which model were you using?
GPT-5.5
What platform is your computer?
Windows
What terminal emulator and version are you using (if applicable)?
Windows Terminal
Codex doctor report
n/a
What issue are you seeing?
Running "codex update" in the terminal gives the following error:
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.142.0 to 0.142.2
==> Detected platform: Windows (x64)
==> Resolved version: 0.142.2
==> Downloading Codex CLI
iex : The term 'Get-FileHash' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and 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
The issue seems to be in the codex binary: when it spawns PowerShell to run the updater, it passes a stripped-down environment in which Get-FileHash can't be loaded. It may be an issue where powershell 7 is the default rather than powershell 5 but unsure.
What steps can reproduce the bug?
Install Codex natively on windows with the installation script (irm https://chatgpt.com/codex/install.ps1 | iex)
Then try and call codex update
What is the expected behavior?
I expect the update process to complete
Additional information
_No response_
9 Comments
The useful diagnostic split here is whether
Get-FileHashis missing from PowerShell itself or only from the environment created bycodex update. It would help to capture$PSVersionTable,$env:PSModulePath, andGet-Command Get-FileHashin the same terminal before running the update. If the updater intentionally strips env vars, it may need to preserve enoughPSModulePathforMicrosoft.PowerShell.Utility, or callMicrosoft.PowerShell.Utility\Get-FileHashwith a fallback hash path on older/minimal Windows shells.I prepared a focused branch for this:
Nicolas0315:codex/windows-install-dotnet-hash55babb969 fix(install): avoid Get-FileHash dependencyWhat changed:
scripts/install/install.ps1no longer depends on theGet-FileHashcmdlet.System.Security.Cryptography.SHA256instead.Verification:
scripts/install/install.ps1Get-Sha256Digestreturns the known SHA256 forabcTest-ArchiveDigestaccepts matching digest and rejects mismatched digestgit diff --checkrtx4090: same PowerShell parser/helper test passednicolas2025: same PowerShell parser/helper test passedrtx5060ti: same PowerShell parser/helper test passedI attempted to open an upstream PR, but GitHub returned:
Nicolas0315 does not have the correct permissions to execute CreatePullRequest.SSH note:
cyberagent-mac-m5maxdoes not havepwshinstalled, andinstall.ps1is Windows-only.It's reproduced on pwsh(PowerShell 7) only.
My powershell.exe(PowerShell 5) works.
Just came there to share - yep the bug is reproducible only on pwsh
vs
looks like Pester is mandatory there to avoid such compatibility issues 😉
was there any updates on this? it's still broken for me in 0.144.3 when i updated to 0.144.4
also having this problem with 0.144.4, using powershell 5 gives me an error about
OSArchitectureproperty not being found, using powershell 7 I get the error mentioned in this issuesame thing here; nothing new here, just wanted to mention that updating through npm is a workaround on my system. this obviously bypasses powershell Get-FileHash..
Environment:
%LOCALAPPDATA%\Programs\OpenAI\Codex\bin\codex.exe
This has the same root cause as #27117: when
codex updateruns from PowerShell 7, thepowershell.exechild it spawns inherits pwsh'sPSModulePath. Windows PowerShell 5.1 then discovers the Core-onlyMicrosoft.PowerShell.Utilitymodule (7.0) ahead of its own 3.1 copy, cannot load it, and does not fall back — soGet-FileHashstops resolving right at the checksum step. That also explains @luckyabsoluter's and @nos1609's observations that only pwsh parents are affected, and why cmd.exe and npm updates work. #27117 has the isolated reproductions and full root-cause analysis.On the fix side, @Nicolas0315's branch above and mine reach the same conclusion independently: computing the archive SHA-256 via .NET removes the
Get-FileHashdependency frominstall.ps1entirely, regardless of what the child process environment looks like. I keep a patch-ready branch rebased against currentmain, 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. A complementary CLI-sidePSModulePathcleanup for theStandaloneWindowschild has also been proposed in #27117.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 | iexSince these reports are spread across several issues, it may help triage to also add a 👍 on #27117 so the combined impact is visible in one place.
Still reproducible with Codex CLI 0.150.1 on Windows.
Running
codex updatefrom Codex CLI 0.149.1 attempts to launch:and fails with:
So the issue appears to still be present in 0.150.1.
This also seems consistent with #27117, where
powershell.exeinherits the PowerShell 7PSModulePath, causing Windows PowerShell 5.1 to fail to resolveGet-FileHash.