This powershell snippet will search for all installed Windows updates and uninstall them one at a time. $Session = New-Object -ComObject Microsoft.Up
This powershell snippet will search for all installed Windows updates and uninstall them one at a time.
$Session = New-Object -ComObject Microsoft.Update.Session
$Searcher = $Session.CreateUpdateSearcher()
$Criteria = "IsInstalled=1 and Type='Software'"
$Updates = $Searcher.Search($Criteria).Updates
$Updates | ForEach-Object {
$_.IsHidden = $true
$_.AcceptEula()
$Installer = $_.Installer
$Installer.Uninstall()
}
This powershell code will list all installed updates and allow you to select one or multiple updates to uninstall.
$Session = New-Object -ComObject Microsoft.Update.Session
$Searcher = $Session.CreateUpdateSearcher()
$Criteria = "IsInstalled=1 and Type='Software'"
$Updates = $Searcher.Search($Criteria).Updates
Write-Host "Installed updates:"
$Updates | ForEach-Object {
Write-Host "$($_.Title) ($($_.Categories[0].Name)) - $($_.Date)"
}
$Selection = Read-Host "Enter the KB number of the update you want to uninstall (comma-separated for multiple updates):"
$KBs = $Selection.Split(",")
$Updates | Where-Object { $KBs -contains $_.Identity.UpdateID } | ForEach-Object {
$_.IsHidden = $true
$_.AcceptEula()
$Installer = $_.Installer
$Installer.Uninstall()
}
COMMENTS