如何检查网络上的计算机是否正在运行更新的窗口

时间:2016-07-13 16:22:55

标签: windows powershell networking

很抱歉,如果问题的措辞方式令人困惑,但基本上我需要一种方法来检查所有计算机是否在网络上更新,因为我最近在员工的计算机上进行了服务呼叫,并注意到它没有一年多来更新。有没有办法可以检查网络上的每台计算机是否更新?我的雇主专门为所有员工工作站使用Windows 7专业版。有没有一种方法可以使用powershell来自动执行此任务?

1 个答案:

答案 0 :(得分:1)

您可以执行以下操作:

# Import CSV with Workstation HostNames
$RemoteComputers = Import-Csv -Path C:\SomePath\CSVwithHostNames.csv

# Get Last Windows Update Install Date from Remote Computers
# If you don't want to use CSV you can specify like -Computername PC1, PC2, PC3
# You could also pull hostnames from Active Directory and store as variable

#PowerShell 2 or Below
Get-WmiObject -ComputerName $RemoteComputers -Class Win32_QuickFixEngineering -Property InstalledOn | Sort InstalledOn -Descending | Select InstalledOn, PSComputerName -First 1

#PowerShell 3 or Higher
Get-CimInstance -ComputerName $RemoteComputers -ClassName Win32_QuickFixEngineering -Property InstalledOn | Sort InstalledOn -Descending | Select InstalledOn, PSComputerName -First 1

输出如下:

InstalledOn           PSComputerName RunspaceId                          
-----------           -------------- ----------                          
7/13/2016 12:00:00 AM SomePCNameHere 691237f3-6ac3-4c7d-a530-5d1717309cfb

如果使用WSUS进行更新,那么运行报告以查看哪些工作站缺少更新会更好/更容易。

希望这有帮助!为了将来参考,这不是代码编写服务,在提问时请包括您已尝试过的代码,然后说明您使用该代码时遇到的问题,因为您更有可能从社区获得答案。