Skip to content

Instantly share code, notes, and snippets.

@privatehosting
Last active August 29, 2015 14:07
Show Gist options
  • Save privatehosting/90117ea70f46a7337788 to your computer and use it in GitHub Desktop.
Save privatehosting/90117ea70f46a7337788 to your computer and use it in GitHub Desktop.
PowerShell Script to Remove Bad Windows Updates
$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