winget list matched the MSI, and winget upgrade couldn't find it
Update, November 12. This article covers an MSI that upgrades to a newer MSI. PowerShell 7.7.0 ships no MSI, so a 7.6 MSI copy cannot upgrade to it this way. What winget answers in that case, and what a switch to the MSIX does when it runs as SYSTEM, is in PowerShell 7.7 ships no MSI: winget and the MSIX as SYSTEM.
On October 14 a Windows 11 desktop in our lab started failing one upgrade. Attestree’s agent runs winget as SYSTEM against a private winget REST source that serves only versions a sandbox verified or an operator accepted. It asked for PowerShell 7.6.7.0:
winget upgrade --id Microsoft.PowerShell --exact --version 7.6.7.0 --installer-type wix --architecture x64 --source <private source>
winget fetched the package’s manifest from the source, got a 200, and about two seconds later answered 0x8A150014, NO_APPLICATIONS_FOUND. On the console that code reads “No installed package found matching input criteria.” Every attempt from October 14 to 17 ended the same way. The desktop ran winget 1.29.380.
PowerShell was installed. Programs and Features listed PowerShell 7-x64, version 7.6.6.0, product code {B1A9B37E-00B6-4BFD-A439-3120FE4F766E}. It was an MSI that winget had not installed. winget list on the same desktop matched it to Microsoft.PowerShell.
On October 17 we ran the same request once as winget install, as SYSTEM. It worked. The 7.6.7.0 MSI ran as a major upgrade, replaced 7.6.6.0 in place, and left one copy.
So list could see the copy and install could replace it, but upgrade could not find it.
Why list and upgrade disagree
The requests winget sent in the test below show that the two commands start from opposite ends.
winget list starts from what is installed. For each entry in Apps & features it asks the source which package the entry belongs to. For an MSI it sends the copy’s own ProductCode, along with a normalized name and publisher.
winget upgrade --id Microsoft.PowerShell --exact, against a REST source, does not search. It fetches the manifest for Microsoft.PowerShell and looks for an installed entry that matches the manifest’s AppsAndFeaturesEntries. Our feed’s manifest for the 7.6.7.0 MSI had no AppsAndFeaturesEntries at all, so nothing on the desktop matched it.
We had two ideas for a fix: put more codes in the manifest, or have the agent retry as an install. We tested both before choosing.
Six feeds on an isolated VM
On October 21 we rebuilt the case on a machine where nothing else could interfere:
- A throwaway Windows 11 Pro VM, build 26200, with no network.
- winget 1.29.380, provisioned for the whole machine and run as SYSTEM, the way the agent runs it. The default sources were turned off by policy.
- PowerShell 7.6.6.0 installed straight from its MSI with
msiexec, so winget had no record of installing it. - A fake winget REST source on localhost. Feed A was a byte-for-byte copy of the lab desktop’s feed, and each other feed changed one thing.
- The real PowerShell installers, with the same SHA-256 hashes as the ones we had tested.
- Every run started from the same checkpoint, and every request winget sent was logged.
Both MSIs share the UpgradeCode {31AB5147-9A97-4452-8443-D9709F0516E1}. Each has its own ProductCode: {B1A9B37E-…} for 7.6.6.0 and {B6950B97-25F0-4EB3-9FC8-DB5D085645DE} for 7.6.7.0. In an MSI major upgrade, each version gets a new ProductCode, and the product line keeps one UpgradeCode.
Each feed got the agent’s own command:
winget upgrade --id Microsoft.PowerShell --exact --silent --accept-package-agreements --accept-source-agreements --installer-type wix --architecture x64 --version 7.6.7.0 --source <feed>
| Feed | AppsAndFeaturesEntries on the 7.6.7.0 installer |
winget list --id |
The upgrade | Box after |
|---|---|---|---|---|
| A, a copy of ours | none | 0x8A150014 |
0x8A150014 |
7.6.6.0 |
| B | 7.6.7.0’s ProductCode | 0x8A150014 |
0x8A150014 |
7.6.6.0 |
| C | 7.6.7.0’s ProductCode and the UpgradeCode | finds 7.6.6.0, offers 7.6.7.0 | installed | 7.6.7.0, one copy |
| D | 7.6.7.0’s and 7.6.6.0’s ProductCodes | 7.6.7.0 installed (wrong) | 0x8A15002B |
7.6.6.0 |
| E | none, but the source answers winget’s ProductCode search | 0x8A150014 |
0x8A150014 |
7.6.6.0 |
| F | the UpgradeCode and DisplayVersion, no ProductCode | finds 7.6.6.0, offers 7.6.7.0 | installed | 7.6.7.0, one copy |
Against feed A, the same command as winget install installed 7.6.7.0 as a major upgrade and left one copy. The next upgrade then answered 0x8A15002B, “No newer package versions are available from the configured sources”, which was correct.
Three results mattered:
- The UpgradeCode is what matched. Feeds C and F worked. Feed B, with the new version’s ProductCode alone, did not.
- Answering winget’s search did not help
upgrade --id. In feed E the source answered winget’s ProductCode search with the package. Plainwinget upgradethen listed 7.6.6.0 to 7.6.7.0 as available, andwinget upgrade --id Microsoft.PowerShell --exactstill answered0x8A150014. - Feed D is a trap. With 7.6.6.0’s ProductCode on the 7.6.7.0 manifest, winget took the old copy for the new version.
winget list --idsaid 7.6.7.0 was installed, and the upgrade answered0x8A15002B. A tool that reads that code as “already up to date” leaves the box on 7.6.6.0 and reports it done.
What we shipped
The release of October 23, listed in the changelog, changed three things:
- The feed reads the UpgradeCode and ProductVersion from each vendor MSI it has tested and serves them as that installer’s
AppsAndFeaturesEntries. It never serves another version’s ProductCode, and it serves no code that two packages claim. MSIs extracted from bundles, and zips that hold one MSI, are served the same way. - When winget searches by an installed MSI’s ProductCode, the feed answers with the one package that owns that code, or with nothing. On the same VM, that made plain
winget listshow the copy with 7.6.7.0 available, andwinget upgrade --allinstall it. - When a pinned upgrade of an MSI copy answers
0x8A150014, and the machine has a machine-wide MSI at the version being upgraded from, the agent sends the same request once as an install. It keeps the version, installer type, architecture and source pins, and it never adds--force.
The same day we checked it on an enrolled test VM running winget 1.29.379. At 03:31 UTC we removed PowerShell 7.6.7.0 and installed the 7.6.6.0 MSI with msiexec /i … /qn. At 03:34 the agent’s next cycle ran the pinned winget upgrade. winget logged “Found one app”, and the 7.6.7.0 MSI ran as a major upgrade of the untracked copy with exit code 0. That VM’s feed served AppsAndFeaturesEntries: [{UpgradeCode: {31AB5147-…}, DisplayVersion: 7.6.7.0}] and no other version’s ProductCode.
The install retry did not run in that check. With the UpgradeCode served, the upgrade no longer failed. We had proven the retry on the isolated VM.
Since October 27 the agent also reports the UpgradeCode of every machine-wide MSI, so the console can match a hand-installed MSI to its package even when the catalog never saw its ProductCode.
Still open
One case is still open. We saw it where the agent does not pin our private source, so winget also uses the public winget source. On October 24, in that setup, an upgrade from PowerShell 7.6.7.0 to 7.6.8 answered 0x8A150014 twice, and the agent backed off. Our inventory had recorded the installed copy against the public source. The install retry did not run, because we limited it to our private source, so nothing upgraded the copy.
We think it is the same mismatch, but we have not confirmed it. Agent 0.249.6, released the same day, runs the retry in that setup too: on an endpoint that is not locked to our private source, it sends the same pinned install to the public winget source, under the same guards. We have not yet seen it clear this case.
The fix also only helps MSIs. An EXE installer that registers no MSI codes has no UpgradeCode to serve.
Update, November 8. That box never ran 0.249.6. On October 26, seconds after its agent began updating from 0.249.2 to 0.250.1, the upgrade to 7.6.8 succeeded. Its signed record does not say whether the retry ran, and the agent’s log from that day is gone, so we still cannot say the retry cleared it. The next release, 7.6.9, upgraded the same box normally the same evening.
What we got wrong
- Our feed served vendor MSIs without
AppsAndFeaturesEntries. We had chosen to store no UpgradeCode at all until a feature needed one. - Our first explanation was wrong. We believed the manifest named the new version’s ProductCode. It named nothing.
- Our first fix idea was feed D, putting the older versions’ ProductCodes on the new manifest. The VM showed it would have hidden the problem, with the box reporting itself current.
- The failures on that one desktop held up a rollout of our own agent while we worked it out.
Checking your own machines
Everything below was tested with winget 1.29.380 against a REST source, except where it says otherwise.
Test with winget list --id, not plain winget list. In all six feeds, winget list --id <Id> --exact --source <source> gave the same answer as winget upgrade --id. When it answered 0x8A150014, so did the upgrade. Plain winget list finding the app tells you less.
Read the verbose log. Add --verbose-logs to the command. When winget ties a package to an entry in Apps & features, the log names the entry, in a line like The entry determined to be associated with the package is 'PowerShell 7.6.6.0-x64'.
Read the codes off the installer. This opens the MSI read-only and prints its UpgradeCode. It works in Windows PowerShell 5.1 and PowerShell 7:
$msi = 'C:\path\to\PowerShell-7.6.7-win-x64.msi'
$installer = New-Object -ComObject WindowsInstaller.Installer
$db = $installer.OpenDatabase($msi, 0)
$view = $db.OpenView("SELECT Value FROM Property WHERE Property='UpgradeCode'")
$view.Execute()
$view.Fetch().StringData(1)
$view.Close()
Change UpgradeCode to ProductCode or ProductVersion for the other two values.
In a private manifest, declare the UpgradeCode. This is feed F’s shape, which we tested and now serve:
Installers:
- Architecture: x64
InstallerType: wix
Scope: machine
InstallerUrl: https://packages.example.com/PowerShell-7.6.7-win-x64.msi
InstallerSha256: EC575CEF9EC56FCD905DE0D5EEAC9CB7F81A0A65ABB87BB5CD0E87FDFE2B8CC0
AppsAndFeaturesEntries:
- DisplayVersion: 7.6.7.0
UpgradeCode: '{31AB5147-9A97-4452-8443-D9709F0516E1}'
Feed C, which also named 7.6.7.0’s own ProductCode, worked too. Never put an older version’s ProductCode on a newer version’s manifest.
If you mirror public manifests into a private REST source, check them for an UpgradeCode. On November 5 the public manifest for PowerShell 7.6.7.0 declared the MSI’s ProductCode and no UpgradeCode. The public community source is a prebuilt index and matches installed apps in its own way, and we did not test this case against it.
When an upgrade cannot find the copy, install over it. If the copy is an MSI and the new MSI is a major upgrade of it, with the same UpgradeCode, winget install --id <Id> --exact --version <new> lets Windows Installer replace it in place. That is what our agent’s retry does. Pin the installer type and architecture first, or you can end up with two copies side by side.
How the agent matches copies it did not install, and where that stops, is on the inventory page.