ChrisTitusTech / ChrisTitusTech/winutil

[Bug Report] Fix WinUtil installer to handle PowerShell MSI installations automatically

Open
#4,977 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PowerShell
Stars
62.9k
Forks
3.7k
Avg merge
5d 11h
Merged PRs (30d)
32

Description

Problem

WinUtil recommends winget upgrade Microsoft.PowerShell. When PowerShell was installed via the MSI at C:\Program Files\PowerShell\7\pwsh.exe, the upgrade fails with:

A newer version was found, but the install technology is different from the current version installed.

Proposed Fix

Detect MSI-installed PowerShell, query the latest release from the PowerShell GitHub API, download the matching PowerShell*-win-x64.msi, run it silently, and remove the temporary installer afterward.

Suggested flow:

$Current = (Get-Command pwsh -ErrorAction SilentlyContinue).Source
if ($Current -like "C:\Program Files\PowerShell\7\pwsh.exe") {
    $Release = Invoke-RestMethod "https://api.github.com/repos/PowerShell/PowerShell/releases/latest"
    $Asset = $Release.assets |
        Where-Object name -match '^PowerShell-.*-win-x64\.msi$' |
        Select-Object -First 1
    $Msi = Join-Path $env:TEMP $Asset.name
    Invoke-WebRequest $Asset.browser_download_url -OutFile $Msi
    Start-Process msiexec.exe -ArgumentList "/i `"$Msi`" /passive /norestart" -Wait
    Remove-Item $Msi -Force
}
else {
    winget upgrade Microsoft.PowerShell
}

This should support future PowerShell versions, require no manual download, preserve the MSI-based installation method, and avoid the recurring winget error.

How to test

  1. Install PowerShell using the MSI.
  2. Run the WinUtil upgrade command or script directly.
  3. Verify that the latest version is installed without the winget error.
  4. Confirm that the temporary MSI file is removed.

Documentation update

Add a README/INSTALL note:

If PowerShell was installed with the MSI, WinUtil automatically upgrades it via the official MSI installer instead of using winget upgrade.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the WinUtil upgrade command or script that handles PowerShell updates, then review the README or INSTALL documentation mentioned in the issue. Reproduce the MSI-installed PowerShell case on Windows and verify the latest x64 MSI is installed without the winget error, the command completes silently, and the temporary MSI is removed.

Written by the indexing model from the issue text.

Assessment

Tech stack
github, powershell
Domain
cli, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.