Skip to content
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

Closed
Barney87 opened this issue Jul 21, 2020 · 13 comments
Closed

PowerShell 7.0.3 - Get-Package cmdlet not working #13225

Barney87 opened this issue Jul 21, 2020 · 13 comments
Labels
Area-PowerShellGet specific to PowerShellGet module Issue-Question ideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a Resolution-Answered The question is answered.

Comments

@Barney87
Copy link

Steps to reproduce

Get-Package
or
Get-Package -Provider Programs -IncludeWindowsInstaller


## Expected behavior

Lists all installed applications on the machine working on below version

Name                           Value
----                           -----
PSVersion                      5.1.19041.1
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.1
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

PS C:\WINDOWS\system32> Get-Package -ProviderName Programs -IncludeWindowsInstaller

Name                           Version          Source                           ProviderName
----                           -------          ------                           ------------
Windows Driver Package - Cr... 01/23/2018 3....                                  Programs
Greenshot 1.2.10.6             1.2.10.6                                          Programs
Logitech Unifying Software ... 2.10.37                                           Programs
Microsoft Visual Studio 201... 10.0.60825                                        Programs
Mozilla Firefox 75.0 (x64 e... 75.0                                              Programs
Mozilla Maintenance Service    75.0                                              Programs
Notepad++ (64-bit x64)         7.8.7                                             Programs
Microsoft Office 365 ProPlu... 16.0.12527.20880                                  Programs
Intel(R) Network Connection... 22.9                                              Programs
Sophos Endpoint Agent          2.7.8                                             Programs
VLC media player               3.0.10                                            Programs
PowerShell 7-x64               7.0.3.0                                           Programs


PS C:\WINDOWS\system32>

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>


## Environment data

<!-- provide the output of $PSVersionTable -->

Name                           Value
----                           -----
PSVersion                      7.0.3
PSEdition                      Core
GitCommitId                    7.0.3
OS                             Microsoft Windows 10.0.19041
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

@Barney87 Barney87 added the Issue-Question ideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a label Jul 21, 2020
@iSazonov
Copy link
Collaborator

/cc @alerickson

@iSazonov iSazonov added the Area-PowerShellGet specific to PowerShellGet module label Jul 22, 2020
@ThomasNieto
Copy link
Contributor

@iSazonov should this be moved to the oneget repo?

@iSazonov
Copy link
Collaborator

@ThomasNieto I added /cc to owners - they can move if needed.

@whitTech
Copy link

whitTech commented Sep 8, 2021

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.

@whitTech
Copy link

whitTech commented Sep 8, 2021

Also, potential dupe of #7844?

@jamacoe
Copy link

jamacoe commented Sep 25, 2021

Still not working on PS Core 7.1.4 on 25th Sep. 2021

@SteveL-MSFT
Copy link
Member

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.

@SteveL-MSFT SteveL-MSFT added the Resolution-Answered The question is answered. label Sep 1, 2022
@ghost
Copy link

ghost commented Sep 3, 2022

This issue has been marked as answered and has not had any activity for 1 day. It has been closed for housekeeping purposes.

@ghost ghost closed this as completed Sep 3, 2022
@A9G-Data-Droid
Copy link

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:
OneGet/oneget#435

Where you see that the ability to uninstall is broken in the older version.
So instead of fixing the problem, they removed the feature.

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.

@ThomasNieto
Copy link
Contributor

@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.

@A9G-Data-Droid
Copy link

I have created a replacement module called AnyPackage

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.

@ThomasNieto
Copy link
Contributor

ThomasNieto commented Apr 18, 2023

@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.

@NetMage
Copy link

NetMage commented Mar 20, 2024

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).

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.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-PowerShellGet specific to PowerShellGet module Issue-Question ideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a Resolution-Answered The question is answered.
Projects
None yet
Development

No branches or pull requests

9 participants