Cleanup WSUS Synchronization Events

Cleanup Windows Server Update Services Synchronization History with this script.

Windows Server Update Services provides a great way to cleanup things like old computers, unneeded updates, and update files from the Windows Server Update Services file system and database.

A different kind of sink

This is not the sink you’re looking for.

Since Windows Server Update Services synchronizes the list of Windows Updates from the source Microsoft Servers on a regular basis, the history of sync events can become quite tedious to load in the User Interface. Frustratingly, there is no way through the user interface to remove old history for synchronization events. The SQL Server T-SQL code below creates a stored procedure that can be used to cleanup old events prior to a particular cut-off date. I run the code via a SQL Server Agent job daily, with a cut-off date of 30 days ago.

Here’s the code to create the stored procedure:

And here’s an example of how to run the proc:

Hopefully this code helps you reduce the sync history in your WSUS database. Let me know in the comments below if you found this useful, or if it doesn’t work for some reason.