OneGet / oneget

PackageManagement (aka OneGet) is a package manager for Windows
MIT License
2.38k stars 190 forks source link

Cannot get list of installed software with PowerShell 7 #543

Closed marco-eckstein closed 8 months ago

marco-eckstein commented 8 months ago

This is a question, but if the answer is yes (which I am afraid it is), it is also an issue:

In Windows PowerShell (a.k.a. PowerShell 5), one could get a list of installed software with Get-Package. In PowerShell (a.k.a. PowerShell Core, PowerShell 7), this is not possible. The list is empty. I guess by adding a package provider like WinGet via Install-PackageProvider WinGet, I could get a partial list, but the crucial providers msi, msu and Programs are not available, neither built-in nor via Find-PackageProvider.

Is Microsoft's modern approach for programmatically getting a list of installed software really using StackOverflow scripts that access the registry? Or is there a better way?

ThomasNieto commented 8 months ago

@marco-eckstein this module is depreciated but you can use its replacement AnyPackage.Programs to get the same functionality.

To get started:

Install-Module -Name AnyPackage.Programs -Force -AllowClobber
Import-Module AnyPackage.Programs

There are other package providers as well like Msu, PSResourceGet, and others. You can see the list here.

ThomasNieto commented 8 months ago

@marco-eckstein let me preface by saying I'm not the PowerShell team and have no control over this repository.

The PowerShell team decided to deprecated this module in favor of making a standalone PSResourceGet module replacing PowerShellGet v2 and abandoning the OneGet model. As such the team hasn't made any enhancements or defect corrections. Now that PSResourceGet is stable the stated plan is to remove OneGet and PowerShellGet v2 in the default install of PowerShell. You can still install it using the PSGallery. The only change I would see them making to OneGet and it's providers is if a security vulnerability is found resulting in a patch.

I'm just a community member who likes the OneGet model of provider based interface to various package managers. AnyPackage was created to fix the design limitations of OneGet and simply the implementation. These two factors were listed on the PSResourceGet RFC as factors to deprecate OneGet.

AnyPackage is a from the ground up redesign of OneGet and does not share any code but I left the cmdlet names and a majority of the interface similar for users of OneGet.

As for your question on why didn't the PowerShell team just fix the existing providers, it seems as though they just wanted to move on from OneGet.

marco-eckstein commented 8 months ago

@ThomasNieto: Thanks for the thorough explanation!

@ Other readers for clarification: I had deleted one of my questions in this issue because I had found out some answers on my own shortly afterwards. But @ThomasNieto was very quick and had a reply in the pipeline already.