winget-cli icon indicating copy to clipboard operation
winget-cli copied to clipboard

PowerShell - Make `Update-WinGetPackage` work just like `winget upgrade` (with no arguments)

Open o-l-a-v opened this issue 1 year ago • 2 comments

Description of the new feature / enhancement

winget upgrade shows a list of installed programs with a newer version available, if any. It also has --include-pinned and --include-unknown.

I find no similar functionality in Microsoft.WinGet.Client. I'd expect Update-WinGetPackage to work the same, so I add this as a feature request.

  • Or add a parameter (switch) -ListAvailableUpdates?

Proposed technical implementation details

Make Update-WinGetPackage act like winget upgrade.

o-l-a-v avatar Apr 13 '24 10:04 o-l-a-v

I find no similar functionality in Microsoft.WinGet.Client

Have you tried using Get-WinGetPackage | Where-Object {$_.IsUpdateAvailable}? This command will include packages with installed versions as "Unknown" by default giving you the --include-unknown functionality. If you want to exclude those, you can do it with a check as: Get-WinGetPackage | Where-Object {$_.IsUpdateAvailable -and $_.InstalledVersion -ne "Unknown"}

As for --include-pinned, I believe that functionality will be added when support for pinning is added to PowerShell module. See https://github.com/microsoft/winget-cli/issues/3234.

Note: Get-WinGetPackage is equivalent to the winget list command. You can think of the above command as an equivalent to winget list --upgrade-available (which itself is equivalent to winget upgrade)

mdanish-kh avatar Apr 13 '24 19:04 mdanish-kh

@mdanish-kh

Yes, I've found the winget list equivalent cmdlet, but I don't view it as equivalent to winget upgrade as it returns all installed packages. Yes you can filter with PowerShell, but still.

If Get-WinGetPackage gets support to view updates for pinned packages too I guess we have the barebone functionality in place. But I'd still want a winget upgrade equivalent cmdlet.

o-l-a-v avatar Apr 13 '24 20:04 o-l-a-v