microsoft / winget-cli

WinGet is the Windows Package Manager. This project includes a CLI (Command Line Interface), PowerShell modules, and a COM (Component Object Model) API (Application Programming Interface).
https://learn.microsoft.com/windows/package-manager/
MIT License
23.31k stars 1.45k forks source link

winget list by Id returns no results for Microsoft.PowerShell when already installed #4718

Open pamanes opened 3 months ago

pamanes commented 3 months ago

Brief description of your issue

Listing installed packages by Id for Microsoft.PowerShell returns: No installed package found matching input criteria.

I know it is installed because this returns correctly:

PS C:\Users\PalaciAl2> (winget list) -like "*Microsoft.PowerShell*"
PowerShell 7.4.3.0-x64              Microsoft.PowerShell                7.4.3.0                 7.4.4.0          winget

Steps to reproduce

Install package Microsoft.PowerShell then run:

winget list --id "Microsoft.PowerShell"

Expected behavior

Should return the installed package.

Actual behavior

PS C:\Users\PalaciAl2> winget list powershell
Name                                    Id                                                     Version      Available Source
----------------------------------------------------------------------------------------------------------------------------
PowerShell 7.4.3.0-x64                  Microsoft.PowerShell                                   7.4.3.0      7.4.4.0   winget
Windows Terminal                        Microsoft.WindowsTerminal                              1.20.11781.0           winget
Microsoft Azure PowerShell - April 2018 ARP\Machine\X64\{3BA7CAA9-97BA-4528-B7E1-B640910BB149} 5.7.0.18831
PS C:\Users\PalaciAl2> winget list --id "Microsoft.PowerShell"
No installed package found matching input criteria.

Environment

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

Windows: Windows.Desktop v10.0.22621.3880
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.23.1911.0

Winget Directories
-------------------------------------------------------------------------------------------------------------------------------
Logs                               %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir
User Settings                      %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json
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
ProxyCommandLineOptions                   Disabled
DefaultProxy                              Disabled
github-actions[bot] commented 3 months ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

Trenly commented 3 months ago

Does it do the same thing with winget list -e --id 'Microsoft.PowerShell' ?

stephengillie commented 3 months ago

I wasn't able to reproduce this behavior on my system:

PS C:\ManVal> winget list powershell
Name             Id                        Version      Source
---------------------------------------------------------------
PowerShell 7-x64 Microsoft.PowerShell      7.4.4.0      winget
Windows Terminal Microsoft.WindowsTerminal 1.20.11781.0 winget

PS C:\ManVal> winget list --id "Microsoft.PowerShell"
Name             Id                   Version Source
-----------------------------------------------------
PowerShell 7-x64 Microsoft.PowerShell 7.4.4.0 winget
jdhitsolutions commented 3 months ago

I think winget applies a regex type pattern. That's why there is the --exact parameter.

PS C:\> winget list --id "Microsoft.PowerShell"
Name                     Id                           Version Source
---------------------------------------------------------------------
PowerShell 7-x64         Microsoft.PowerShell         7.4.4.0 winget
PowerShell 7-preview-x64 Microsoft.PowerShell.Preview 7.5.0.3 winget

PS C:\> winget list --id "Microsoft.PowerShell" --exact
Name             Id                   Version Source
-----------------------------------------------------
PowerShell 7-x64 Microsoft.PowerShell 7.4.4.0 winget