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

Can't uninstall Powershell

Open Gavin-Williams opened this issue 1 year ago • 1 comments

Brief description of your issue

Powerwell won't update, and tells me to uninstall existing version. But when I try to uninstall I get an error.

Steps to reproduce

❯ winget list --name Microsoft.Powershell No installed package found matching input criteria.

❯ winget uninstall --name Microsoft.Powershell No installed package found matching input criteria.

Expected behavior

I expect to see that powershell is installed and which version. And I expect to then be able to uninstall it.

Actual behavior

Oh dear. What can i say, it's behaving like a hello-world app that just prints out error messages. I'm yet to see winget actually do anything.

Environment

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

Windows: Windows.Desktop v10.0.22631.3085
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.21.3482.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

Gavin-Williams avatar Feb 04 '24 19:02 Gavin-Williams

--name filters packages based on the DisplayName string value they write to Registry. That's the name of the package visible in Control Panel / Apps&Features. Microsoft.PowerShell is the unique identifier given to the package in the winget repository, so --id is the filter you're looking for here.

You may find more value in just winget list powershell since that forces the match on many different parameters listed in the manifest (substring match on ID, name, tags, commands etc..).

However, looking at another issue you raised (#4139), I'm guessing you want to unblock the winget install/upgrade Microsoft.PowerShell command. The output of winget list powershell on your machine would give me more context, but I'm assuming you have a side-by-side installation of PowerShell MSIX (installed from MS store) and PowerShell MSI (can be installed through their github releases / through winget). WinGet currently can't reason correctly about side-by-side installations (see https://github.com/microsoft/winget-cli/issues/2129). It maps both of the installations to the same PackageId (Microsoft.PowerShell), and gets confused as to which installer type to update. You can either use --force to force winget to bypass the check, or provide exact matching by the DisplayName (since PowerShell MSI and PowerShell MSIX use a different name in Apps&Features).

TLDR


Use either one of these commands:

  • winget upgrade Microsoft.PowerShell --force
  • winget upgrade --name "PowerShell 7-x64" (if you have the 64-bit version)

to bypass the installer type check

mdanish-kh avatar Feb 05 '24 10:02 mdanish-kh

We've been working on the side-by-side scenarios. You could try the latest release and enable the experimental feature on:

  • https://github.com/microsoft/winget-cli/releases/tag/v1.8.924-preview

Please provide feedback at:

  • https://github.com/microsoft/winget-cli/discussions/4281

denelon avatar Apr 02 '24 19:04 denelon