Force WSUS to Synchronize Now from PowerShell

After passing my MS 70.410 exam I had a little bit of free time on my hands, so I thought I’d clean up my WSUS servers and prepare them for Windows 10 and VS 2015. So I thought I’d force myself to do the whole thing via PowerShell. The problem is that the UpdateServices PowerShell module doesn’t have cmdlets for some things I wanted to do –force a synchronization was among them. So I needed use the Microsoft.UpdateServices.NET components to perform these functions.

Useful Commands

To force a WSUS server to synchronize now:


To get the result of the last synchronization:


Pretty simple! I’m sure additional functions will crop up and I’ll try to post any useful ones here as well.


WSUS – Declining all Superceded Updates – NOW!

Just a quick snippet today. I wrote this because I was didn’t want to have to wait for 30 days before unusused superceded updates in my WSUS server were automatically declined – especially those daily “Definition Update for Windows Defender”.


If you’re happy waiting for these unused superceded updates to be declined after 30 days then you can just use the following cmdlet:

Invoke-WsusServerCleanup -DeclineSupersededUpdates

However, if you don’t want to wait you can fire off this little PowerShell script. It is just a single line of PowerShell code that will automatically decline all updates with a status of anything except for declined and has at least one superceding update:

Get-WSUSUpdate -Classification All -Status Any -Approval AnyExceptDeclined `
    | Where-Object { $_.Update.GetRelatedUpdates(([Microsoft.UpdateServices.Administration.UpdateRelationship]::UpdatesThatSupersedeThisUpdate)).Count -gt 0 } `
    | Deny-WsusUpdate

The command will take a few minutes to run (depending on how many updates your WSUS Server has) – on my WSUS server it took about 5 minutes. Once the process has completed you could then trigger the cmdlet to perform a WSUS Server cleanup (to get rid of any obsolete content files):

Invoke-WsusServerCleanup -CleanupObsoleteUpdates -CleanupUnneededContentFiles

That is about it for today!