Repository navigation
docs(install): Windows PowerShell 5.1 that inherits PowerShell 7's PSModulePath - #593
Merged
Merged
Conversation
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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Get-FileHashunderinstall.ps1. This happens when 5.1 is started through another program that PowerShell 7 launched, such ascmd.exe, Python, a build tool or an editor task. That 5.1 inherits PowerShell 7'sPSModulePath, finds PowerShell 7's copies of built-in modules first and cannot load them.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
powershellrun stopped atGet-FileHash.install.ps1, for example resettingPSModulePathwhen it detects 5.1. That is an installer change and needs its own decision.powershellat 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
pwsh;cmd /c "set PSModulePath=&& powershell ..."form, which clears the variable for the child.-ExecutionPolicy Bypassgoes (before-File), and that-Binaryinstalls do not useGet-FileHash. For checking a binary's digest it suggestspwshorcertutil -hashfile.Validation
git diff --check: cleancargo fmt --all: N/A, docs onlycargo check --workspace: N/A, docs onlycargo clippy --workspace --all-targets -- -D warnings: N/A, docs onlycargo test --workspace: N/A, docs onlyinstall.ps1Download-And-Install(catch block).Expand-Archive,Install-BinaryandAdd-ToUserPath.install.ps1and Microsoft's about_PSModulePath. Round 1 found that a directly startedpowershellis not affected, and the section was rewritten. Round 2 had no blockers, and its fixes are in.PR Readiness