尝试在 Windows 2012R2 和 Windows 2008 服务器上获取所有已安装的软件包
Trying to get all installed packages on Windows 2012R2 and Windows 2008 Server
我正在尝试检索 Windows 服务器(2012R2 和 2008)上所有已安装的软件包。 Win 2012 有 PowerShell V4,Win 2008 有 PowerShell V3。
尝试使用 Poweshell 命令 "Get-Package" 但这仅适用于 Powershell 版本 5 及更高版本。
尝试点击下面的链接,但无法获得任何输出。
https://powershell.org/2015/10/using-package-management-in-windows-powershell-v3/
如果能为 Powershell 版本(3 和 4)提供备用命令,我们将不胜感激。提前感谢您的时间和努力。
PS C:\Users\Administrator> Get-Package
Get-Package : The term 'Get-Package' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Get-Package
+ ~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-Package:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\Users\Administrator> Get-PackageProvider | Select-Object -Property Name | Sort-Object -Property Name
Get-PackageProvider : The term 'Get-PackageProvider' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again.
At line:1 char:1
+ Get-PackageProvider | Select-Object -Property Name | Sort-Object -Property Name
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-PackageProvider:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\Users\Administrator> Get-Command -Module PackageManagement | Select-Object -Property Name | Format-Wide -Column 2
PS C:\Users\Administrator> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
3 0 -1 -1
PS C:\Users\Administrator> Get-Package
Get-Package : The term 'Get-Package' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Get-Package
+ ~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-Package:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\Users\Administrator> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
4 0 -1 -1
我希望得到像
这样的结果
PS C:\Users\Administrator> Get-Package | select Name, Version
Name Version
---- -------
Amazon SSM Agent 2.3.444.0
Amazon SSM Agent 2.3.444.0
AWS Tools for Windows 3.15.666
AWS PV Drivers 8.2.6
aws-cfn-bootstrap 1.4.31
Update for Windows Defender Antivirus antimalware platform - KB4052623 (Version 4.18.1903.4)
Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.291.1405.0)
Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.291.1225.0)
Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.291.1155.0)
Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.291.1077.0)
Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.291.1016.0)
Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.291.920.0)
Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.291.76.0)
Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.291.9.0)
Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.289.1652.0)
Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.289.1237.0)
Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.289.1157.0)
Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.289.1094.0)
Update for Windows Defender Antivirus antimalware platform - KB4052623 (Version 4.18.1902.2)
Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.289.911.0)
你可以看看 wmi:
Get-WmiObject -Class Win32_Product | Select Name, Version | Sort
或者
wmic product get name,version
但最好的来源可能是卸载注册表项。看到这个 link
远程机器列表可以通过下面的命令获取
Get-WmiObject -Class Win32_Product -ComputerName MachineName
Get-CimInstance -ClassName win32_InstalledWin32Program | Select Name, Version, Vendor | ConvertTo-Json
我正在尝试检索 Windows 服务器(2012R2 和 2008)上所有已安装的软件包。 Win 2012 有 PowerShell V4,Win 2008 有 PowerShell V3。
尝试使用 Poweshell 命令 "Get-Package" 但这仅适用于 Powershell 版本 5 及更高版本。
尝试点击下面的链接,但无法获得任何输出。 https://powershell.org/2015/10/using-package-management-in-windows-powershell-v3/
如果能为 Powershell 版本(3 和 4)提供备用命令,我们将不胜感激。提前感谢您的时间和努力。
PS C:\Users\Administrator> Get-Package
Get-Package : The term 'Get-Package' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Get-Package
+ ~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-Package:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\Users\Administrator> Get-PackageProvider | Select-Object -Property Name | Sort-Object -Property Name
Get-PackageProvider : The term 'Get-PackageProvider' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again.
At line:1 char:1
+ Get-PackageProvider | Select-Object -Property Name | Sort-Object -Property Name
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-PackageProvider:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\Users\Administrator> Get-Command -Module PackageManagement | Select-Object -Property Name | Format-Wide -Column 2
PS C:\Users\Administrator> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
3 0 -1 -1
PS C:\Users\Administrator> Get-Package
Get-Package : The term 'Get-Package' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Get-Package
+ ~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-Package:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\Users\Administrator> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
4 0 -1 -1
我希望得到像
这样的结果PS C:\Users\Administrator> Get-Package | select Name, Version
Name Version
---- -------
Amazon SSM Agent 2.3.444.0
Amazon SSM Agent 2.3.444.0
AWS Tools for Windows 3.15.666
AWS PV Drivers 8.2.6
aws-cfn-bootstrap 1.4.31
Update for Windows Defender Antivirus antimalware platform - KB4052623 (Version 4.18.1903.4)
Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.291.1405.0)
Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.291.1225.0)
Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.291.1155.0)
Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.291.1077.0)
Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.291.1016.0)
Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.291.920.0)
Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.291.76.0)
Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.291.9.0)
Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.289.1652.0)
Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.289.1237.0)
Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.289.1157.0)
Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.289.1094.0)
Update for Windows Defender Antivirus antimalware platform - KB4052623 (Version 4.18.1902.2)
Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.289.911.0)
你可以看看 wmi:
Get-WmiObject -Class Win32_Product | Select Name, Version | Sort
或者
wmic product get name,version
但最好的来源可能是卸载注册表项。看到这个 link
远程机器列表可以通过下面的命令获取
Get-WmiObject -Class Win32_Product -ComputerName MachineName
Get-CimInstance -ClassName win32_InstalledWin32Program | Select Name, Version, Vendor | ConvertTo-Json