PowerShell-Release : --tag v7.4.5 --version 7.4.5.0 is not upgrading or installing via winget from --source winget. Note: I am on PowerShell Core 7.4.4
Prerequisites
- [X] Write a descriptive title.
- [X] Make sure you are able to repro it on the latest released version
- [X] Search the existing issues.
- [X] Refer to the FAQ.
- [X] Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
I am having no luck installing or upgrading the v7.4.5 Release of PowerShell.
Here are some Software Versions that (may) be relevant?
- Windows Terminal : --id Microsoft.WindowsTerminal ; version : v1.21.2361.0 ; source : winget
- WinGet : version : v1.8.1911
- PowerShell : PS> $PSVersionTable : 3.1. PSVersion : 7.4.4 3.2. PSEdition : Core 3.3. GitCommitId : 7.4.4 3.4. OS : Microsoft Windows 10.0.19045 3.5. Platform : Win32NT 3.6. PSCompatibleVersions : {1.0, 2.0, 3.0, 4.0 ...} 3.7. PSRemotingProtocolVersion : 2.3 3.8. SerializationVersion : 1.1.0.1 3.9. WSManStackVersion : 3.0
Expected behavior
PS> winget find --id Microsoft.PowerShell -s winget
#<should find --id Microsoft.PowerShell -s winget --version 7.4.5.0>
PS> winget upgrade --id Microsoft.PowerShell -s winget
#<should upgrade --id Microsoft.PowerShell -s winget to --version 7.4.5.0>
Expected: Latest Release version of PowerShell (--tag v7.4.5) (--e v7.4.5.0) would upgrade the existing installed version (--version 7.4.4.0).
Actual behavior
PS> winget upgrade --id Microsoft.PowerShell -s winget
#<the latest version should be defaulted to>
PS> No available upgrade found.
PS> No newer package versiona are available from the configured sources.
Actual:
PS> winget find --id Microsoft.PowerShell -s winget -v 7.4.5.0
#<DOES Find --id Microsoft.PowerShell -s winget -v 7.4.5.0 >
PS> winget upgrade --id Microsoft.PowerShell -s winget
#<DOES NOT Find --id Microsoft.PowerShell -s winget -v 7.4.5.0>
#<ERRORS WITH:
PS> No available upgrade found.
PS> No newer package versiona are available from the configured sources.
>
Error details
Get-Error returns Nothing.
Environment data
$PSVersionTable
Name Value
---- -----
PSVersion 7.4.4
PSEdition Core
GitCommitId 7.4.4
OS Microsoft Windows 10.0.19045
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
No response
I note that you have raised previous similar issues with upgrading via winget for 7.4.3 in #23970 & 7.4.4 in #24111 which I see 7.4.4 ended up being resolved by Windows Update installing the update for you in the end. Unfortunately, if we don't get to the bottom of this then you are going to have this issue on every new version, which I understand is not a great experience, but it will at least self-resolve via Windows Update.
As this is something to do with how winget is seeing your install of powershell vs what's listed as available to try install/upgrade from winget
Could you please run all of the following and screenshot what is output
# This should rule out this being the MSIX install
Get-AppxPackage | Where Name -Match PowerShell | Select Name,InstallLocation
# Get info of your winget environment
winget --info
# set verbose logging when running the winget commands
winget list --id Microsoft.PowerShell --verbose-logs
## Skipping running winget find as you've said that works above
# Attempt to upgrade with logs
winget upgrade --id Microsoft.PowerShell -s winget v7.4.5.0 --verbose-logs --open-logs
the attempt to upgrade it will pop open your file explorer to the winget log files location If you could provide the files in that folder that should have only just been modified as these may hold a clue as to what is going on here
You might be able to install the upgrade by running this which should do a full install after removing the current version
winget install --id Microsoft.PowerShell -s winget -v 7.4.5.0 --uninstall-previous -force
cc @denelon @StevenBucher98
accidental keyboard combo closed it
This was a fun one to dig into & I'm pretty certain I have managed to understand and I believe replicate what has been happening for @iCanHazConfetti in this issue as well as in https://github.com/PowerShell/PowerShell/issues/23970 & in https://github.com/PowerShell/PowerShell/issues/24111 There is a possibility this behaviour may continue to happen for future releases, however, I do think that this can be avoided for others but likely needs a change in how Microsoft Update Installs the preview version and actually correctly identifies it as the preview package not the stable package.
Key points
- Stable and Preview versions have been installed either via winget or other means & then crucially have not been updated by winget but most likely been updated by Microsoft Update
- When Microsoft Update runs
- Preview version
7.5.1.0gets "upgraded" to a newly installed Package Name ofPowerShell 7.5.2.0-x64- winget sees these "upgrades" as a
Microsoft.PowerShellpackage & notMicrosoft.PowerShell.Previewpackage
- winget sees these "upgrades" as a
- Stable version 7.4.2 gets "upgraded to a newly installed Package Name of
PowerShell 7.4.3.0-x64- winget sees these "upgrades" as a
Microsoft.PowerShellpackage as expected
- winget sees these "upgrades" as a
- Preview version
The conflict here in what winget sees is why winget upgrade does not work
I think the only fix here for @iCanHazConfetti is to get winget is to force a fresh install by not using winget upgrade here & optionally attempt to uninstall previous versions too
- stable
winget install --id Microsoft.PowerShell -s winget -v 7.4.5.0 --uninstall-previous --force- this should remove the lingering old version
7.3.8.0if not then runningwinget uninstall --id Microsoft.PowerShell -v 7.3.8.0should do it
- this should remove the lingering old version
- preview
winget install --id Microsoft.PowerShell.Preview -s winget -v 7.5.0.4 --uninstall-previous --force
Pain points in investigating
- inability to tell winget not to try manage an installed application (I am raising another issue for this in the winget repo)
- metadata clashes between what winget sees re package name & upgradable versions
- releases to winget are delayed from when the new release notification popup shows to users
- issue gets raised on every new release of PowerShell
- suggestion to on a winget install of PowerShell to turn off the notification check banner
- if installed by winget then we should decide whether or not to allow microsoft update installs & if we do then it needs to be sure that winget will see the correct ID for either - Q for @SteveL-MSFT & @denelon to dig into, I personally think that if installed via winget it's being managed by winget and not Microsoft Update but there is benefit in having fallback on Microsoft Update if a user doesn't run winget upgrade
- issue gets raised on every new release of PowerShell
- preview releases aren't installed by Microsoft Update as
PowerShell Preview - 7.5.0.4which is a potential bug - confirmed by downloading and installing the update package from Microsoft Update Catalog- Example being that 7.5.0-preview2 is installed as PowerShell 7.5.2.0-x64
- missing metadata for v7.4.3 in the update catalog too
Notes
I noticed that you have a 7.4x (stable) and 7.5x (preview) versions on your machine & an older 7.3.8 install from an image that you shared in this https://github.com/PowerShell/PowerShell/issues/24111#issuecomment-2276867052
In my testing it looks to me that both 7.3.x and 7.5.x (no matter how they'd been installed) had been updated via Microsoft Update. I noticed this as the version numbers are returned as part of the Name via winget list --id Microsoft.PowerShell which I have seen on a number of my machines when it is allowed to be updated by Microsoft Update.
I then noticed that when you install PowerShell via winget, which I did across multiple machines & sandboxes to be sure, the name of the package returned by winget is as follows
If you install the update package for 7.5.0-preview.2 winget will incorrectly ID it as not being the Microsoft.PowerShell.Preview package - which is a bug @SteveL-MSFT that I don't know where this needs raised to be fixed
The writeup on this would not have taken so long if I wasn't having issues with my laptop & thankfully my comments here in GitHub between reboots and shutdowns where saved & not lost
This was a fun one to dig into & I'm pretty certain I have managed to understand and I believe replicate what has been happening for @iCanHazConfetti in this issue as well as in #23970 & in #24111 There is a possibility this behaviour may continue to happen for future releases, however, I do think that this can be avoided for others but likely needs a change in how Microsoft Update Installs the preview version and actually correctly identifies it as the preview package not the stable package.
Key points
Stable and Preview versions have been installed either via winget or other means & then crucially have not been updated by winget but most likely been updated by Microsoft Update
When Microsoft Update runs
Preview version
7.5.1.0gets "upgraded" to a newly installed Package Name ofPowerShell 7.5.2.0-x64
- winget sees these "upgrades" as a
Microsoft.PowerShellpackage & notMicrosoft.PowerShell.PreviewpackageStable version 7.4.2 gets "upgraded to a newly installed Package Name of
PowerShell 7.4.3.0-x64
- winget sees these "upgrades" as a
Microsoft.PowerShellpackage as expectedThe conflict here in what winget sees is why winget upgrade does not work
I think the only fix here for @iCanHazConfetti is to get winget is to force a fresh install by not using
winget upgradehere & optionally attempt to uninstall previous versions too
stable
winget install --id Microsoft.PowerShell -s winget -v 7.4.5.0 --uninstall-previous --force
- this should remove the lingering old version
7.3.8.0if not then runningwinget uninstall --id Microsoft.PowerShell -v 7.3.8.0should do itpreview
winget install --id Microsoft.PowerShell.Preview -s winget -v 7.5.0.4 --uninstall-previous --forcePain points in investigating
inability to tell winget not to try manage an installed application (I am raising another issue for this in the winget repo)
metadata clashes between what winget sees re package name & upgradable versions
releases to winget are delayed from when the new release notification popup shows to users
issue gets raised on every new release of PowerShell
- suggestion to on a winget install of PowerShell to turn off the notification check banner
if installed by winget then we should decide whether or not to allow microsoft update installs & if we do then it needs to be sure that winget will see the correct ID for either - Q for @SteveL-MSFT & @denelon to dig into, I personally think that if installed via winget it's being managed by winget and not Microsoft Update but there is benefit in having fallback on Microsoft Update if a user doesn't run winget upgrade
preview releases aren't installed by Microsoft Update as
PowerShell Preview - 7.5.0.4which is a potential bug - confirmed by downloading and installing the update package from Microsoft Update Catalog
- Example being that 7.5.0-preview2 is installed as PowerShell 7.5.2.0-x64
missing metadata for v7.4.3 in the update catalog too
Notes
I noticed that you have a 7.4x (stable) and 7.5x (preview) versions on your machine & an older 7.3.8 install from an image that you shared in this #24111 (comment) In my testing it looks to me that both 7.3.x and 7.5.x (no matter how they'd been installed) had been updated via Microsoft Update. I noticed this as the version numbers are returned as part of the Name via
winget list --id Microsoft.PowerShellwhich I have seen on a number of my machines when it is allowed to be updated by Microsoft Update.I then noticed that when you install PowerShell via winget, which I did across multiple machines & sandboxes to be sure, the name of the package returned by winget is as follows
If you install the update package for 7.5.0-preview.2 winget will incorrectly ID it as not being the Microsoft.PowerShell.Preview package - which is a bug @SteveL-MSFT that I don't know where this needs raised to be fixed
The writeup on this would not have taken so long if I wasn't having issues with my laptop & thankfully my comments here in GitHub between reboots and shutdowns where saved & not lost
THESE COMMANDS WORKED :
PowerShell Stable Release : PS> winget install --id Microsoft.PowerShell -s winget -v 7.4.5.0 --uninstall-previous --force
This should remove the lingering old version 7.3.8.0 <IT DID, THIS DID WORK ON MY MACHINE>
if not then running winget uninstall --id Microsoft.PowerShell -v 7.3.8.0 should do it <THIS WAS NOT NECESSARY ON MY MACHINE>
PowerShell Preview Release : PS> winget install --id Microsoft.PowerShell.Preview -s winget -v 7.5.0.4 --uninstall-previous --force
This should remove the lingering old version 7.5.0.-preview.2 <IT DID, THIS WORKED ON MY MACHINE>
if not then running winget uninstall --id Microsoft.PowerShell -v 7.3.8.0 should do it <THIS STEP WAS NOT NECESSARY ON MY MACHINE>
-- @iCanHazConfetti
This issue has been marked as external and has not had any activity for 1 day. It has been be closed for housekeeping purposes.
This issue has been marked as answered and has not had any activity for 1 day. It has been closed for housekeeping purposes.
📣 Hey @iCanHazConfetti, how did we do? We would love to hear your feedback with the link below! 🗣️
🔗 https://aka.ms/PSRepoFeedback


