如何使用 PowerShell 比较两台 Windows 服务器之间已安装的修补程序?

MDM*_*rra 9 windows powershell

我需要使用 PowerShell 比较开发环境和生产环境之间已安装的补丁。我怎样才能做到这一点?

MDM*_*rra 11

我最近写了一篇关于这个问题的博客,并提出了这个脚本。您可以在两台计算机上以管理员身份运行它,也可以使用命令-Credential上的选项get-hotfix

$server1 = Read-Host "Server 1"
$server2 = Read-Host "Server 2"

$server1Patches = get-hotfix -computer $server1 | Where-Object {$_.HotFixID -ne "File 1"}

$server2Patches = get-hotfix -computer $server2 | Where-Object {$_.HotFixID -ne "File 1"}

Compare-Object ($server1Patches) ($server2Patches) -Property HotFixID
Run Code Online (Sandbox Code Playgroud)