是否可以获得远程计算机已安装软件的列表?我知道使用 Powershell 对本地计算机执行此操作。是否可以使用 Powershell 获取远程计算机的已安装软件并将此列表保存在远程计算机上?这我用于本地计算机:Get-WmiObject -Class Win32_Product | 选择对象-属性名称
在此先感谢,最好的问候,
是否可以获得远程计算机已安装软件的列表?我知道使用 Powershell 对本地计算机执行此操作。是否可以使用 Powershell 获取远程计算机的已安装软件并将此列表保存在远程计算机上?这我用于本地计算机:Get-WmiObject -Class Win32_Product | 选择对象-属性名称
在此先感谢,最好的问候,
这使用 Microsoft.Win32.RegistryKey 检查远程计算机上的 SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall 注册表项。
https://github.com/gangstanthony/PowerShell/blob/master/Get-InstalledApps.ps1
*编辑:粘贴代码以供参考
function Get-InstalledApps {
param (
[Parameter(ValueFromPipeline=$true)]
[string[]]$ComputerName = $env:COMPUTERNAME,
[string]$NameRegex = ''
)
foreach ($comp in $ComputerName) {
$keys = '','\Wow6432Node'
foreach ($key in $keys) {
try {
$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $comp)
$apps = $reg.OpenSubKey("SOFTWARE$key\Microsoft\Windows\CurrentVersion\Uninstall").GetSubKeyNames()
} catch {
continue
}
foreach ($app in $apps) {
$program = $reg.OpenSubKey("SOFTWARE$key\Microsoft\Windows\CurrentVersion\Uninstall\$app")
$name = $program.GetValue('DisplayName')
if ($name -and $name -match $NameRegex) {
[pscustomobject]@{
ComputerName = $comp
DisplayName = $name
DisplayVersion = $program.GetValue('DisplayVersion')
Publisher = $program.GetValue('Publisher')
InstallDate = $program.GetValue('InstallDate')
UninstallString = $program.GetValue('UninstallString')
Bits = $(if ($key -eq '\Wow6432Node') {'64'} else {'32'})
Path = $program.name
}
}
}
}
}
}
有多种方法可以获取远程计算机上已安装软件的列表:
在 ROOT\CIMV2 命名空间上运行 WMI 查询:
使用 wmic 命令行界面:
使用 Powershell 脚本:
来源:https ://www.action1.com/kb/list_of_installed_software_on_remote_computer.html