The Install.ps1 doesn't return OSArchitecture correctly for all Windows PowerShell Versions Correctly

Open 💬 2 comments Opened May 2, 2026 by thedwindlingdba
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What issue are you seeing?

The Install.ps1 is leveraging this to pull the OS Architecture
$architecture = [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture

Under certain PowerShell configurations, that specific Property is filtered out, so it returns nothing and the script produces an error.

To ensure it returns properly across all PowerShell configurations. You should utilize this
$architecture = [System.Runtime.InteropServices.RuntimeInformation,mscorlib]::OSArchitecture.ToString().ToLower()

What steps can reproduce the bug?

Open PowerShell 7 or 5.1
Install-Module PSReadLine -force
Import-Module PSReadline
.\Install.ps1
Observe the error message that OSArchitecture doesn't exist on said object.

What is the expected behavior?

The script succeeds and doesn't produce an error

Additional information

_No response_

View original on GitHub ↗

2 Comments

github-actions[bot] contributor · 3 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #19559

Powered by Codex Action

z-a-f · 2 months ago

Not a solution, but a potential workaround is to use the pwsh:

pwsh -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"