[reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration")

$wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer();

$wsus.GetUpdates() | Where {$_.UpdateClassificationTitle -eq 'Drivers'} | ForEach-Object {$wsus.DeleteUpdate($_.Id.UpdateId.ToString()); Write-Host $_.Title removed }

 

$computerscope = New-Object Microsoft.UpdateServices.Administration.ComputerTargetScope

$updatescope = New-Object Microsoft.UpdateServices.Administration.UpdateScope

 

$wsus.GetSummariesPerUpdate($updatescope,$computerscope) | ?{$_.InstalledCount -ne 0} |select -First 1 | %{$_ | ft *; $wsus.GetUpdate([guid]$_.updateid)}

$wsus.GetSummariesPerUpdate($updatescope,$computerscope) | ?{$_.InstalledCount -eq 0 -and $_.DownloadedCount -eq 0 -and $_.NotInstalledCount -eq 0}

$wsus.GetSummariesPerUpdate($updatescope,$computerscope) | ?{$_.InstalledCount -eq 0 -and $_.DownloadedCount -eq 0 -and $_.NotInstalledCount -eq 0} | select -First 1 | %{$wsus.GetUpdate([guid]$_.updateid)}

$wsus.GetSummariesPerUpdate($updatescope,$computerscope) | ?{$_.InstalledCount -eq 0 -and $_.DownloadedCount -eq 0 -and $_.NotInstalledCount -eq 0} | %{$u = $wsus.GetUpdate([guid]$_.updateid); $wsus.DeleteUpdate($u.Id.UpdateId.ToString()); Write-Host $u.Title removed}