Skip to content

docs(install): Windows PowerShell 5.1 that inherits PowerShell 7's PSModulePath - #593

Merged
BunsDev merged 4 commits into
mainfrom
docs/ps51-psmodulepath
Nov 19, 2026
Merged

BunsDev merged 4 commits into
mainfrom
docs/ps51-psmodulepath

Conversation

@BunsDev

@BunsDev BunsDev commented Nov 19, 2026

Copy link
Copy Markdown
Member

Summary

  • docs/installation.md gains a section on Windows PowerShell 5.1 failing to load Get-FileHash under install.ps1. This happens when 5.1 is started through another program that PowerShell 7 launched, such as cmd.exe, Python, a build tool or an editor task. That 5.1 inherits PowerShell 7's PSModulePath, finds PowerShell 7's copies of built-in modules first and cannot load them.
  • The installer then prints Download failed: The term 'Get-FileHash' is not recognized ... and suggests checking that the release exists. The section explains that the release is fine, that nothing is installed, and how to run the installer instead.

Context

  • Related issue/user request: decision 19 of the 2026-11-18 maintenance sweep report. The failure was seen on the hosted Windows runner while testing fix(install): replace an existing engine only with consent #553: the job starts Python from PowerShell 7, and the powershell run stopped at Get-FileHash.
  • Scope: docs/installation.md only.
  • Non-goals: changing install.ps1, for example resetting PSModulePath when it detects 5.1. That is an installer change and needs its own decision.
  • Typing powershell at a PowerShell 7 prompt is not affected. PowerShell 7 removes its own module paths for a Windows PowerShell it starts directly (about_PSModulePath, "Starting Windows PowerShell from PowerShell 7"). The section says so.

Changes

  • New subsection "Windows PowerShell 5.1: 'Get-FileHash' is not recognized" under "Standalone installation". It covers:
    • the cause, and which launches are affected;
    • the installer's exact output;
    • that the installer stops before extracting: no executable is installed, an existing install is untouched, and the user PATH is unchanged.
  • It gives three ways to run the installer:
    • under pwsh;
    • from a Windows PowerShell 5.1 started outside PowerShell 7;
    • with Microsoft's cmd /c "set PSModulePath=&& powershell ..." form, which clears the variable for the child.
  • Notes on where -ExecutionPolicy Bypass goes (before -File), and that -Binary installs do not use Get-FileHash. For checking a binary's digest it suggests pwsh or certutil -hashfile.

Validation

  • git diff --check: clean
  • cargo fmt --all: N/A, docs only
  • cargo check --workspace: N/A, docs only
  • cargo clippy --workspace --all-targets -- -D warnings: N/A, docs only
  • cargo test --workspace: N/A, docs only
  • Targeted/manual checks:
    • The quoted output matches install.ps1 Download-And-Install (catch block).
    • The checksum check runs before Expand-Archive, Install-Binary and Add-ToUserPath.
    • Two rounds of independent review against install.ps1 and Microsoft's about_PSModulePath. Round 1 found that a directly started powershell is not affected, and the section was rewritten. Round 2 had no blockers, and its fixes are in.
  • Not run: the workarounds were not run on Windows by hand. Clearing the variable is the approach Microsoft documents, and the one the hosted Windows installer tests in fix(install): replace an existing engine only with consent #553 use.

PR Readiness

  • Diff is limited to the intended files.
  • Generated files were not edited by hand.
  • User-facing docs/help were updated or are not needed.
  • No secrets, credentials, local paths, or unrelated logs are included.
  • Remaining risks or follow-up work are listed above.

A powershell.exe started from a pwsh session inherits PSModulePath and
cannot load Get-FileHash, so install.ps1 stops at the checksum step with
a "Download failed" error that points at the release. Say that nothing
is installed and how to run the installer instead: under pwsh, from a
5.1 started outside PowerShell 7, or with PSModulePath cleared for the
child. No installer change.
PowerShell 7 strips its own module paths for a powershell.exe it starts
directly; the inherited PSModulePath breaks a 5.1 started through cmd,
Python or another intermediate. Use Microsoft's cmd form to clear the
variable, and note execution policy, the PATH and -Binary.
…ertutil

Review follow-up: -ExecutionPolicy goes before -File; the cmd one-liner
needs a Command Prompt or PowerShell in a local folder; a Command Prompt
started indirectly from PowerShell 7 inherits the variable too; name the
error in the heading.
@vercel

vercel Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
docs Ready Ready Preview Nov 19, 2026 3:51pm UTC

Request Review

@BunsDev
BunsDev merged commit 495ca4f into main Nov 19, 2026
7 checks passed

This branch was successfully deployed

1 active deployment
Preview — a375b363 Deployed Nov 19, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant