Uninstall windows updates via powershell

Share This

Given the latest Windows Update saga with KB50000802 causing BSOD issues when trying to print to Certain Printers, you may be looking for a quick way to remove the offending update until Microsoft provide a fix to this issue. This method will work with any Windows Update you wish to remove via Powershell, simply substitute the KB number with the update you wish to remove.

The easiest way is to open Windows Update and remove the offending update

However if you’ve already patched your organisation it may be too late, rather than manually uninstalling the update on each machine, I’ve put together a little Powershell Script you can run on your PC’s. The Script will check to see if the PC has the update installed, if it does, it will remove it. Since the update was released as KB5000802 and KB5000808 if on Win 10 1909, i’ve referenced both the KB numbers.

## ##Copyright 2021 - Liam Robinson ####
#### https://liam-robinson.co.uk ####
#############################
$CheckUpdates = Get-Hotfix | Where-Object {$_.hotfixid -eq 'KB5000802'}

if(($CheckUpdates)){
# IF KB5000802 is instalked then uninstall it
Write-Output "Uninstalling KB5000802"
Write-Output "System will prompt reboot when done"
wusa /uninstall /kb:5000802
}else {
# IF KB5000802 is not installed then check if KB5000808 is installed
$CheckUpdates2 = Get-Hotfix | Where-Object {$_.hotfixid -eq 'KB5000808'}
if(($CheckUpdates2)){
#If it is then uninstall it
Write-Output "Uninstalling KB5000808"
Write-Output "System will prompt reboot when done"
wusa /uninstall /kb:5000808
}else {
#If it isnt then do nothing
Write-Output "The Update was not found on this system, exiting"
Start-Sleep -s 5
exit
}

Write-Output "The Update was not found on this system"
exit

}

The update will take around 10-20 minutes to uninstall depending on your system, the /quiet /promptrestart switch does not work in Windows 10, deploy this script to your clients using your normal method i.e Microsoft Endpoint Configuration Manager (formerly SCCM) and run as SYSTEM. The script will work when a user is logged in however will require user interaction and admin rights.

Microsoft have not pulled the update so ensure you have paused windows updates or the update will come back.

Did you enjoy this article?
Signup today and receive free updates straight in your inbox. We will never share or sell your email address.

One thought on “Uninstall windows updates via powershell

Leave a Reply

Your email address will not be published. Required fields are marked *