PowerShell: Cannot update PowerShell through winget because newer versions aren't always available through it
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
The problem I’m having is that even though PowerShell notifies me that there’s a new version available (in this case, 7.3.2), I can’t upgrade through the winget
application, because winget only has my current version (7.3.1) available. As a consequence, running winget upgrade Microsoft.PowerShell
tells me the application is already up to date.
Expected behavior
New versions of PowerShell should always and immediately be available through winget as well, if an update notification goes out.
I say should because winget is listed as the recommended method for installing PowerShell on Windows, but if it doesn’t have the latest version of PowerShell available, it defeats the purpose of making that recommendation.
What’s more, even the official guide for installing PowerShell implies, at least at the time of writing, that 7.3.1 is the latest stable version of PowerShell, even though it should say it’s 7.3.2.
Actual behavior
winget upgrade Microsoft.PowerShell
says there is no applicable upgrade, even though a new version of PowerShell is available.
Error details
No response
Environment data
Name Value
---- -----
PSVersion 7.3.1
PSEdition Core
GitCommitId 7.3.1
OS Microsoft Windows 10.0.22621
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
Here is a screenshot of my PowerShell terminal tab that clearly shows a) a new version notification, b) winget not having that new version, c) winget upgrade not installing the new PowerShell version:
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 11
- Comments: 22 (2 by maintainers)
I’m seeing this again with current installed version 7.3.5, and announced newer version 7.3.6.
How about we turn that on it’s head ? The update notification should not go out until winget, store and other distribution mechanisms have are ready to deliver it.
I’m not sure how the check is done today, but it can’t be impossible to check something which is updated only when the package is downloadable from all sources.
This is just annoying and seems so unnecessary, why are we getting nagged to update something that isn’t available yet? I agree that if winget is the recommended approach, then it should behave properly as the OP stated.
And why is this closed when it clearly is not resolved.
Addressing some of the comments in this issue
Unfortunately this is something that will be for a while as this is not fully automated to publish to winget-pkgs repo yet.
Even when that is done there are then barriers in WinGet’s approval process to their feed that will stop it being listed right away and likely will never be available instantly unless they add a mechanism for you to search for & install packages that are pending to be added to the feed, but that’s a winget issue not a PowerShell issue to fix
Just because a package was installed with one method doesn’t mean it is then managed by that method so it can’t be assumed to be the case however the notifications (in the console and in VSCode) can be disabled by configuration options already by users or admins easily enough and are documented already. PowerShell can be done by setting the
POWERSHELL_UPDATECHECK
environment vairable toOff
as per the about_update_notifications help doc VSCode can be done with this setting"powershell.promptToUpdatePowerShell": false
There is the possible ask here -
that when installed from xyz method, run an post-install task to set those settings if possible
however my view (not the teams btw) is that this should be managed either by the end user/admin/org administrator as otherwise if each install method sets it then you could have the expectation to see the message and set it so you do and then the process overwrites your settings.Well understood to the team & community how annoying it can be with how this currently works but it is of use for those of us that aren’t using any package management tooling & area installing as soon as they can directly from GitHub when it is released or those that have many different ways of managing their software on their machines all working together (or like I found at one point [perhaps against each other like I found in PowerShell Update Oddness)
However technically it is available, just not immediately available via certain install/update methods like winget, chocolatey, Microsoft Update etc which all have delays due to having their own schedules for verifying and then publishing the package to their feeds & is mostly outside the PSTeam responsibility to improve.
However, the team is working on getting this process more streamlined so that when the latest pwsh version is available the work to push to winget’s package repo will be automated so that it can be made available in winget as soon as they make it possible as it’s still done manually today. As mentioned there are also however additional steps required by winget team that slows down packages from being published to their feed as can be seen from the Azure Pipelines being run in the PR to add v.7.3.9 to winget’s feed
Again this is a winget area to solve more than a PowerShell Team one to solve but they are working together to shorten the gap as best as possible.
However if winget did add ability for searching for packages that are pending approval & listing in the feed then that would negate for lots of similar issues and comments around this being raised here and other software repos going forward. Hence why I’d raised this issue to ask for the winget-cli team to add a way to do it - please upvote it if you think it makes sense.
This has been asked for time and time again and whilst it’s been asked for a built in Update-PowerShell cmdlet the closest that I have found is via the Install-PowerShell script available in this repo which I use as a way for installing side by side versions for testing purposes Whilst it isn’t currently a documented way for installing PowerShell it is in use in many places and does still give you a supported install of PowerShell at the end of it.
Hope all these comments helped understand what the latest with this is.
Thanks - the real win for me is learning about
POWERSHELL_UPDATECHECK
and simply setting that toOff
, system-wide. I don’t need to have the latest version as it drops and I’m quite happy to let, eg, windows update (or my sparodicwinget upgrade --all
invocations) do the work. I just wanted to suppress the message.Powershell and Visual Studio Code should not notify of a powershell upgrade when it is not yet available with winget, especially when the installed powershell is managed strictly by winget. This needs to be reopened and fixed permanently as this behaior has been repreated multiple times this calendar year.
Looks like the PR is borked ?
https://github.com/microsoft/winget-pkgs/pull/112154
Although closed as resolved, 3 weeks ago at time of writing, this issue still appears to be a problem.
I’ve literally just updated powershell via vscode because it offered to when I opened it and I’ve been unable to winget the update it’s nagging about for days.
So another way we could turn this on it’s head is if pwsh could update itself - I mean, if vscode can download & run the installer, pwsh could.