[英]powershell windows missing updates
嘗試創建 powershell 腳本以列出丟失或掛起的 Windows 更新。 目的是針對計算機/服務器列表運行腳本,以查看是否有任何丟失的更新或修補程序,並生成您需要查看的服務器列表。
有沒有人對此有解決方案,一直環顧四周,但沒有成功找到執行此操作的腳本。
TechNet 中有一個示例腳本,它執行您正在尋找的核心邏輯:
用於列出缺少的更新的 Powershell 腳本
腳本:
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
示例輸出:
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.