This is the Windows Server Update Services support team blog. We cover all things relating to WSUS and Windows Update.
You know how after you’ve been using WSUS for a while and you go into the admin console, then to the Synchronization node, you can end up waiting and waiting for the list to enumerate? This is the list I’m talking about:
Have you ever wished you could just clear that list and start fresh? Well with a simple SQL script now you can. To do this, the first thing you’ll need to do is fire up the SQL Server Management Studio and connect to whatever server your WSUS server is using. In my case I’m using SQL Server 2008 so mine looks like this:
Now if you’re using the Internal Database for WSUS then you’ll want to connect to \\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query which is what I did below:
Next navigate to the SUSDB database:
Right-click on SUSDB and select New Query:
In the Query windows enter and execute the following query:
USE SUSDB GO DELETE FROM tbEventInstance WHERE EventNamespaceID = '2' AND EVENTID IN ('381', '382', '384', '386', '387', '389')
Just paste those three lines in the window and hit the Execute button:
On my system I get this. Note the success at the bottom:
That’s about all there is to it so you can go ahead and close the SQL Management Studio. Now when you go to the WSUS admin console it should look something like this:
Just like new. Of course every time you make changes to any database you should make a backup first and this is no different. Also a special thanks to Joe Tindale for the script above. Thanks Joe!
J.C. Hornbeck | Manageability Knowledge Engineer
great post... thanks a million! what about a script that only deletes synchronizations where no changes occurred (no new, revised, or expired updates)?
Great post.. Thanks a lot. Really helpful
To leave the recent logs in the database, use:
DELETE FROM tbEventInstance WHERE EventNamespaceID = '2' AND EVENTID IN ('381', '382', '384', '386', '387', '389') AND DATEDIFF(month, TimeAtServer, CURRENT_TIMESTAMP) >= 3;
Does anyone have a powershell script that I can use to do this?
Or delete from a spesific date and older:
DELETE FROM tbEventInstance WHERE EventNamespaceID = '2' AND EVENTID IN ('381', '382', '384', '386', '387', '389') AND TimeAtServer < '2013-05-01'
Very nice post!
Thank you! I had 2165 records and it would hang the console for quite a while when loaded.