If you have downstream WSUS servers in your environment, you might need them to start their synchronization immediately instead of waiting for the schedule. However, you don’t have the time to spend connecting via the WSUS snap-in to each downstream server.
This is a PowerShell method for getting a WSUS downstream server to start the synchronization process immediately.
(Get-WsusServer).GetSubscription().StartSynchronization()
There are so many different ways to run this across all of your servers today but I will provide an example using a Salt state file. This file will be named SyncWSUSDownstream.sls and will be put in the the base Salt environment.
SyncWSUSDownstream:
cmd.run:
- name: (Get-WsusServer).GetSubscription().StartSynchronization()
- shell: powershell
Now, I can run the following to hit all my WSUS servers. In this example, this would be all servers with names that start with WSUS followed by two digits.
salt WSUS?? state.sls SyncWSUSDownstream saltenv=base
To get the status of a synchronization and the last result, you can run the following. These can also be added to the above state file.
(Get-WsusServer).GetSubscription().GetSynchronizationProgress()
(Get-WsusServer).GetSubscription().GetLastSynchronizationInfo().Result
If you have any other WSUS commands you find helpful, be sure to leave a comment below!
Comments