Skip to content

fix(powershell): handle unavailable Update-Module#1993

Open
niStee wants to merge 1 commit intotopgrade-rs:mainfrom
niStee:fix-powershell-force
Open

fix(powershell): handle unavailable Update-Module#1993
niStee wants to merge 1 commit intotopgrade-rs:mainfrom
niStee:fix-powershell-force

Conversation

@niStee
Copy link
Copy Markdown
Contributor

@niStee niStee commented Apr 29, 2026

What does this PR do

Closes #1443.

This changes the PowerShell module update step to avoid passing -Force to Update-Module when --yes is used. Instead, it passes -Confirm:$false and conditionally adds AcceptLicense when the installed Update-Module supports it.

It also checks whether PowerShellGet can provide Update-Module before running the update. If Update-Module is unavailable or cannot be loaded, Topgrade now prints a warning and marks the step as skipped instead of failing with a command-not-found error or reporting OK after doing no update.

This helps Windows PowerShell 5.1 setups where PowerShellGet/PackageManagement are broken, blocked by cloud-backed module folders, or otherwise cannot be autoloaded.

Standards checklist

  • The PR title is descriptive
  • I have read CONTRIBUTING.md
  • Optional: I have tested the code myself, with the relevant tools installed. If yes, add Topgrade's output of the relevant steps.
  • If this PR introduces new user-facing messages they are translated

AI involvement

I used AI assistance while investigating the PowerShell behavior, drafting the code change, and running local checks. I reviewed the changes myself before submitting.

@niStee
Copy link
Copy Markdown
Contributor Author

niStee commented Apr 29, 2026

Tested with:

  • cargo fmt --check
  • cargo test
  • cargo clippy --all-targets -- -D warnings
  • Manual PowerShell checks with PowerShell 7, Windows PowerShell 5.1, gsudo, and native Windows sudo.

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.

PowerShell module update step fails on Windows 11 25H2

1 participant