Auto-decline “Preview of Monthly Updates”

In WSUS it isn’t very easy to clear on how to automatically decline updates based on more criteria than what you get out of the box.  Luckily with powershell we can get around this.  Using a scheduled task to execute powershell.exe with a -file parameter, I was able to decline the “Preview of Monthly Quality Rollups” Microsoft has introduced.

Keeping this simple, using some searches I was able to find enough base information to get connected up to WSUS through powershell and then able to decline the updates.

[void][reflection.assembly]::LoadWithPartialName(“Microsoft.UpdateServices.Administration”)
$wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer("wsus",$False)
$UpdateScope = New-Object Microsoft.UpdateServices.Administration.UpdateScope
$UpdateScope.ApprovedStates = "NotApproved"
$PreviewUpdates = $wsus.GetUpdates($UpdateScope) | Where-Object {$_.Title -like "*Preview of Monthly*"} | ForEach-Object {$_.Decline(); $wsus.DeleteUpdate($_.Id.UpdateId.ToString());}

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.