PowerShell Script to decline all Superseded Updates in WSUS

At time troubleshooting on cases we had to decline updates which are superseded  from the WSUS and hence help to make sure that the no of updates the update agent scan is reduced.


#Change server name and port number and $True if it is on SSL

[String]$updateServer1 = "CMCAS"

[Boolean]$useSecureConnection = $False

[Int32]$portNumber =8530

# Load .NET assembly


$count = 0

# Connect to WSUS Server

$updateServer = [Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer($updateServer1,$useSecureConnection,$portNumber)

write-host "<<<Connected sucessfully >>>" -foregroundcolor "yellow"

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

$u=$updateServer.GetUpdates($updatescope )

foreach ($u1 in $u )


if ($u1.IsSuperseded -eq 'True')


write-host Decline Update : $u1.Title


$count=$count + 1



write-host Total Declined Updates: $count



write-host "Error Occurred"

write-host "Exception Message: "

write-host $_.Exception.Message

write-host $_.Exception.StackTrace





This posting /Script is provided "AS IS" with no warranties and confers no rights