microsoft / microsoft/winget-cli

`Get-WinGetPackage`'s `-Exact` option doesn't function

Open
#4,561 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue-Docs PowerShell
Dominant language
C++
Stars
26.4k
Forks
1.8k
Avg merge
1d 11h
Merged PRs (30d)
15

Description

Brief description of your issue

I'm getting different behavior between winget list -Exact and Get-WinGetPackage -Exact, and it looks like the -Exact option of Get-WinGetPackage is bugged. When -Exact is passed to Get-WinGetPackage, it is always returning nothing.

Steps to reproduce
🪟 Windows 11 Enterprise(10.0.22631) (pwsh) ~
at 08:12:16 PM ❯ winget list --id Microsoft.WindowsTerminal
Name                     Id                                Version      Source
-------------------------------------------------------------------------------
Windows Terminal         Microsoft.WindowsTerminal         1.20.11381.0 winget
Windows Terminal Preview Microsoft.WindowsTerminal.Preview 1.21.1382.0  winget

🪟 Windows 11 Enterprise(10.0.22631) (pwsh) ~
at 08:13:01 PM ❯ winget list --id Microsoft.WindowsTerminal --exact
Name             Id                        Version      Source
---------------------------------------------------------------
Windows Terminal Microsoft.WindowsTerminal 1.20.11381.0 winget

🪟 Windows 11 Enterprise(10.0.22631) (pwsh) ~
at 08:13:03 PM ❯ Get-WinGetPackage -Id Microsoft.WindowsTerminal -Source winget

Name                     Id                                Version      Available Source
----                     --                                -------      --------- ------
Windows Terminal         Microsoft.WindowsTerminal         1.20.11381.0           winget
Windows Terminal Preview Microsoft.WindowsTerminal.Preview 1.21.1382.0            winget


🪟 Windows 11 Enterprise(10.0.22631) (pwsh) ~
at 08:13:20 PM ❯ Get-WinGetPackage -Id Microsoft.WindowsTerminal -Source winget -Exact
Expected behavior

I expected the output of Get-WinGetPackage -Id Microsoft.WindowsTerminal -Source winget -Exact to match winget list --id Microsoft.WindowsTerminal --exact

Actual behavior

Get-WinGetPackage -Id Microsoft.WindowsTerminal -Source winget -Exact returns nothing

Environment
winget info:

Windows Package Manager v1.7.11261
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.22631.3737
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.22.11261.0

Winget Directories
-----------------------------------------------------------------------------------------------------------------------
Logs                               %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\Diag…
User Settings                      %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\sett…
Portable Links Directory (User)    %LOCALAPPDATA%\Microsoft\WinGet\Links
Portable Links Directory (Machine) C:\Program Files\WinGet\Links
Portable Package Root (User)       %LOCALAPPDATA%\Microsoft\WinGet\Packages
Portable Package Root              C:\Program Files\WinGet\Packages
Portable Package Root (x86)        C:\Program Files (x86)\WinGet\Packages
Installer Downloads                %USERPROFILE%\Downloads

Links
---------------------------------------------------------------------------
Privacy Statement   https://aka.ms/winget-privacy
License Agreement   https://aka.ms/winget-license
Third Party Notices https://aka.ms/winget-3rdPartyNotice
Homepage            https://aka.ms/winget
Windows Store Terms https://www.microsoft.com/en-us/storedocs/terms-of-sale

Admin Setting                             State
--------------------------------------------------
LocalManifestFiles                        Disabled
BypassCertificatePinningForMicrosoftStore Disabled
InstallerHashOverride                     Disabled
LocalArchiveMalwareScanOverride           Disabled

winget powershell module info:

Get-Module Microsoft.WinGet.Client

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Binary     1.8.1133              Microsoft.WinGet.Client             {Add-WinGetSource, Assert-WinGetPackageManager, D…

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 with the Get-WinGetPackage entry point and compare its -Exact handling with the reproduced winget list --exact behavior. Done means Get-WinGetPackage -Id Microsoft.WindowsTerminal -Source winget -Exact returns the exact package, matching the CLI output, with the reported case covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.