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:

(Get-WsusServer).GetSubscription().StartSynchronization()

To get the result of the last synchronization:

(Get-WsusServer).GetSubscription().GetLastSynchronizationInfo()

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

3 thoughts on “Force WSUS to Synchronize Now from PowerShell

  1. John Smith says:

    A couple notes, it seems like it takes a few seconds for it to actually kick off before .GetLastSynchronizationInfo() shows it’s running. The time it shows appears to be UTC.

    Like

      • I’ve only ever run these commands on the WSUS Server itself. So if you are running it on the WSUS Server, then no you don’t.

        You might be able to run this remotely but I haven’t tried. If so the command would look something like this:
        (Get-WsusServer -Name MyWSUSServer.Contoso.local -Port 8530).GetSubscription().StartSynchronization()

        Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s