WSUS - need to trigger a script when new updates are synchronised.


  • I have a single WSUS server running on 2012R2, using WID rather than full SQL. WSUS is set to synchronise on a schedule. I want to be able to trigger a PowerShell script when a synchronisation has resulted in new updates being downloaded. However, I can't find a way to do this. So far I have looked at:

    WSUS console: The only related setting I can find is notification by email.

    Scheduled task: WSUS adds a random offset of up to 30 minutes to the synchronisation times, so I can't schedule a task to accurately coincide with the synchronisation.

    Event Log: When I first started this, I naively assumed WSUS would be logging information events when it synchronised and that I would be able to make an event-triggered scheduled task. However, I cannot find any such events in the Windows event log, or any mention of relevant event IDs from Googling. I've found references to event IDs for various synchronisation errors, but nothing for normal, successful synchronisation.

    I've found tantalising references in SoftwareDistribution.log such as:

    "EventLogEventReporter.ReportEvent EventId=384,Type=Information,Category=Synchronization,Message=Synchronization completed successfully."

    However there is no event 384 showing in my Event Log, so I assume that the above refers to some kind of internal WSUS event log.

    So - if I'm missing something about WSUS event logging, or if anyone can suggest any other way to trigger a script when WSUS synchronises new updates I'd be really grateful.

    Thank you!

    Friday, April 21, 2017 2:25 PM

All replies