Last active
August 29, 2015 14:07
-
-
Save privatehosting/90117ea70f46a7337788 to your computer and use it in GitHub Desktop.
PowerShell Script to Remove Bad Windows Updates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$kbs = @(2975719,2975179,2977174,2982791,2984006,2993651,2994897,2995004,2995005) | |
$kbSearch = "KB" + ($kbs -join " OR KB") | |
foreach($kb in $kbs) | |
{ | |
$remKbCmd = "wusa.exe /uninstall /kb:$kb /quiet /log /norestart" | |
Write-Host "Uninstalling KB$kb with '$remKbCmd'" | |
Invoke-Expression -Command $remKbCmd; | |
Write-Host "Waiting for KB$kb removal to finish ..." | |
while (@(Get-Process wusa -ErrorAction SilentlyContinue).Count -ne 0) | |
{ | |
Start-Sleep 1 | |
} | |
Write-Host "" | |
} | |
Write-Host "" | |
Write-Host "Verify removal using '$kbSearch' in installed updates." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment