DISM Uninstall Remove Stubborn Packages
I find that for stubborn packages, using DISM is best.
Take a look at all the "Update" packages:
Get-WindowsPackage -Online |?{$_.ReleaseType -like "Update"} | `
ForEach-Object {Get-WindowsPackage -Online -PackageName $_.PackageName} |select Description |ft -autosize
Remove a single package:
Get-WindowsPackage -Online |?{$_.ReleaseType -like "Update"} | `
ForEach-Object {Get-WindowsPackage -Online -PackageName $_.PackageName} | `
Where-Object {$_.Description -like "*KB5020874*"} |Remove-WindowsPackage -Online -NoRestart
Or uninstall all patches/hotfixes to get back to Release To Manufacturing (RTM):
Get-WindowsPackage -Online |?{$_.ReleaseType -like "Update"} |Remove-WindowsPackage -Online -NoRestart
Hotfix Uninstall
Get all packages from get-hotfix that classified as "Updates":
get-hotfix |?{$_.description -eq "Update"}
if (get-hotfix -id KB5009543) {
wusa /uninstall /kb:5009543
}
PSWindowsUpdate Uninstall
Remove-WindowsUpdate -KBArticleID KB5020874
$KBs = Get-WUHistory -Last 7 | Select-Object -ExpandProperty kb
Foreach ($KB in $KBs) {
Uninstall-WindowsUpdate -KBArticleID $KB
}
Get-WUHistory | ?{$_.Description -like "*Update*"} |Select -ExpandProperty kb |`
Foreach ($KB in $KBs) {
Uninstall-WindowsUpdate -KBArticleID $KB
}