PowerShell 查找刪除Windows補丁文件

今天早上收到了總公司的一個郵件通告,大意是最新的3月份的Windows補丁文件kb4088875會形成Vmware下的Windows 7和 Windows 2008 R2失去IP地址,望你們注意。shell

豆子通常用WSUS服務器打補丁,並且頻率比較積極。上WSUS一看呢,這個安全補丁已經默認 Approve了,趕快 decline掉。安全

PowerShell 查找刪除Windows補丁文件

PowerShell 查找刪除Windows補丁文件

由於這個補丁已經出來有2周了,估計有些服務器已經打上補丁了,這些已經安裝了的補丁不會自動刪除掉。儘管我在wsus上禁止安裝了,這個設定只會對沒有安裝的服務器起做用,對於已經安裝了的須要手動刪除。服務器

用Powershell搜索一下,看看哪些機器已經安裝了。ide

$a=Get-ADComputer -Filter {operatingsystem -like "*2008 R2*"} | select name

$b=invoke-command -ComputerName $a.name -script {Get-Hotfix | where {$_.HotFixId -like "KB4088875"}} -ErrorAction SilentlyContinue

結果以下,還好就幾臺
PowerShell 查找刪除Windows補丁文件ui

刪除補丁也很容易,執行下面的遠程命令rest

invoke-command -ComputerName $b.pscomputername -script {Start-Process wusa.exe -ArgumentList '/KB:4088875 /uninstall /quiet /norestart' -Wait }code

從新掃描一次 okay 成功刪除blog

相關文章
相關標籤/搜索