-
Notifications
You must be signed in to change notification settings - Fork 7.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PowerShell 7.0.3 - Get-Package cmdlet not working #13225
Comments
/cc @alerickson |
@iSazonov should this be moved to the oneget repo? |
@ThomasNieto I added /cc to owners - they can move if needed. |
Hi all, Has there been any progress on this issue? Alternatively, can someone explain the reason for the issue, and/or recommend some workarounds? Many thanks. |
Also, potential dupe of #7844? |
Still not working on PS Core 7.1.4 on 25th Sep. 2021 |
What's happening is that PowerShellGet v2 and PackageManagement are shipped with PS7. However, all the package providers you get with WinPS aren't included. So when you import (explicitly or implicitly) the PackageManagement module, you get the PS7 one since that's earlier in the path and that one doesn't have all of the package providers. If you want the WInPS behavior with those providers, you should explicitly import that one under "C:\Program Files\WindowsPowerShell\Modules\PackageManagement\1.0.0.1\PackageManagement.psd1" (root drive and version could be different). So this is working as designed. You can always install the relevant package providers to get the same behavior as WinPS. |
This issue has been marked as answered and has not had any activity for 1 day. It has been closed for housekeeping purposes. |
Note to future readers; when @SteveL-MSFT says "working as designed" he means that the functionality was removed on purpose. If you run the old PowerShell 5 you will find it's using the older version of the PackageManagement which contains the functionality you are looking for. Unfortunately, that leads you to run into this issue: Where you see that the ability to uninstall is broken in the older version. Long story short: Don't expect to use Microsoft Package Management tools to manage installed programs. WinGet is also broken. That's right, Microsoft has two new tools "WinGet" and "OneGet" that are both broken. Even the older "Get-WmiObject" doesn't work as it can't see all installed applications. You will find plenty of examples of software that doesn't show up despite appearing in control panel. Not to mention "Metro Apps" or whatever they are called today. You will need to download 3rd party tooling to manage installed applications. |
@A9G-Data-Droid Microsoft has deprecated OneGet, and due to that I have created a replacement module called AnyPackage. It has a Programs provider that can retrieve Add/Remove programs. It doesn't have uninstall capabilities at the moment but is being tracked in anypackage/programs#6 but you won't run into the issue where it silently fails. |
How does this compare to Chocolatey, Scoop, Ninite, AppGet, Npackd, and OneGet? And why not just join one of those projects? I'm consistently baffled by the fact that the Linux world has more than 6 fully functional package managers to choose from and there isn't a single one that can get it right on Windows. |
@A9G-Data-Droid like OneGet, AnyPackage is not a package manager but a way to interface with various package managers. Currently there is Chocolatey, Scoop, WinGet providers. |
Import-Module C:\Program Files\WindowsPowerShell\Modules\PackageManagement\1.0.0.1\PackageManagement.psd1 Import-Module: Assembly with same name is already loaded A more helpful answer would have been appreciated. |
Steps to reproduce
Get-Package
or
Get-Package -Provider Programs -IncludeWindowsInstaller
Actual behavior
PS C:\Program Files\PowerShell\7> Get-Package
PS C:\Program Files\PowerShell\7>
or
PS C:\Program Files\PowerShell\7> Get-Package -Provider Programs -IncludeWindowsInstaller
Get-Package: Unable to find package providers (Programs).
PS C:\Program Files\PowerShell\7>
The text was updated successfully, but these errors were encountered: