[英]powershell windows missing updates
Trying to create powershell script to list missing or pending windows update.尝试创建 powershell 脚本以列出丢失或挂起的 Windows 更新。 The purpose would be to run the script against a list of computers/servers to see if there are any missing updates or hot-fixes and generate a list of what servers you need to look at.
目的是针对计算机/服务器列表运行脚本,以查看是否有任何丢失的更新或修补程序,并生成您需要查看的服务器列表。
Does anyone have a solutions for this, have been looking around without any success finding scripts to do this.有没有人对此有解决方案,一直环顾四周,但没有成功找到执行此操作的脚本。
There's a sample script from TechNet that does the core logic you're looking for: TechNet 中有一个示例脚本,它执行您正在寻找的核心逻辑:
Get-WindowsUpdates.ps1 获取-WindowsUpdates.ps1
There's also the older VBScript-based WUA_SearchDownloadInstall.vbs .还有较旧的基于 VBScript 的 WUA_SearchDownloadInstall.vbs 。
Powershell script to list missing updates用于列出缺少的更新的 Powershell 脚本
Script:脚本:
Set-ExecutionPolicy -ExecutionPolicy Unrestricted
#List all missing updates
Write-Output "Creating Microsoft.Update.Session COM object"
$session1 = New-Object -ComObject Microsoft.Update.Session -ErrorAction silentlycontinue
Write-Output "Creating Update searcher"
$searcher = $session1.CreateUpdateSearcher()
Write-Output "Searching for missing updates..."
$result = $searcher.Search("IsInstalled=0")
#Updates are waiting to be installed
$updates = $result.Updates;
Write-Output "Found $($updates.Count) updates!"
$updates | Format-Table Title, AutoSelectOnWebSites, IsDownloaded, IsHiden, IsInstalled, IsMandatory, IsPresent, AutoSelection, AutoDownload -AutoSize
pause
Sample output:示例输出:
Creating Microsoft.Update.Session COM object
Creating Update searcher
Searching for missing updates...
Found 4 updates!
Title AutoSelectOnWebSites IsDownloaded IsHiden IsInstalled IsMandatory IsPrese
nt
----- -------------------- ------------ ------- ----------- ----------- -------
Intel - Other hardware - Intel(R) Xeon(R) E3 - 1200/1500 v5/6th Gen Intel(R) Core(TM) PCIe Controller (x16) - 1901 False False False False False
Intel - Other hardware - Intel(R) Xeon(R) E3 - 1200/1500 v5/6th Gen Intel(R) Core(TM) Gaussian Mixture Model - 1911 False False False False False
Microsoft Silverlight (KB4481252) False False False False False
SQL Server 2019 RTM Cumulative Update (CU) 4 KB4548597 False False False False False
Press Enter to continue...:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.