简体   繁体   English

PowerShell 7 “Get-Package”命令返回 NOTHING 作为结果。 PowerShell 5 RETURNS 同一台电脑上的包列表

[英]PowerShell 7 “Get-Package” command returns NOTHING as result. PowerShell 5 RETURNS list of packages on the same computer

I have many packages on my lap top.我的笔记本电脑上有很多包裹。 I have preinstalled PS 5 and installed PS 7. I install many software packages using the scripts in PS 7. If I run Get-Package command in PowerShell version 7 I am not getting anything as output.我已经预装了 PS 5 并安装了 PS 7。我使用 PS 7 中的脚本安装了许多软件包。如果我在 PowerShell 版本 7 中运行 Get-Package 命令,我将无法获得 output 中的任何内容。

PS C:\Windows\System32> Get-Package
PS C:\Windows\System32>

If I run the same command in PowerShell 5 on the same computer I am getting many results:如果我在同一台计算机上的 PowerShell 5 中运行相同的命令,我会得到很多结果:

PS C:\windows\system32> Get-Package

Name                           Version          Source                           ProviderName
----                           -------          ------                           ------------

Git version 2.9.0              2.9.0                                             Programs
Microsoft SQL Server 2017 (...                                                   Programs
Microsoft SQL Server 2019 (...                                                   Programs
Office 16 Click-to-Run Exte... 16.0.11929.20606                                  msi
Office 16 Click-to-Run Loca... 16.0.11929.20606                                  msi
Office 16 Click-to-Run Lice... 16.0.11929.20606                                  msi

How is this possible???这怎么可能??? Get-Command is the Windows command which should return result in any case. Get-Command 是 Windows 命令,在任何情况下都应该返回结果。 Please help, Thanks请帮忙,谢谢

It looks like newer Powershells don't support the Programs and Msi providers.看起来较新的 Powershell 不支持 Programs 和 Msi 提供程序。 Not good.不好。

Get-PackageProvider  # from Powershell 5

Name     Version DynamicOptions
----     ------- --------------
msi      3.0.0.0 AdditionalArguments
Programs 3.0.0.0 IncludeWindowsInstaller, IncludeSystemComponent

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM