WSUS 3.0 SP1 Server Cleanup Wizard via Script

2017-12-11T14:49:04+00:00 June 2nd, 2011|Azure, Cloud, Windows|

We were looking for a way to schedule the WSUS server cleanup wizard recently, as we were running into a few issues with a WSUS server using more disk space than it really needed.

We could get space on the drive via running through the WSUS Server Cleanup wizard in the WSUS MMC, but we wanted a way that we could schedule this in every week to automatically run instead of having to run it manually.

Unfortunately scheduling the WSUS server clean-up wizard is not available natively,  however codeplex have released a tool which is just a simple EXE, that you are able to schedule via task scheduler that will do the same job as the WSUS server cleanup Wizard.

You can download the tool from “http://wsus.codeplex.com/releases/view/17612

Once you download this copy them to a folder location on the WSUS server and the launch command prompt.

Now map to the folder location and create the script to meet your needs (Examples Below referenced from http://wsus.codeplex.com/releases/view/17612“)

“WSUSCleanupCL.exe Server SSL Port Parameters

server = WSUS server name.
SSL = ‘t’ if using SSL otherwise ‘f’.
Port = port number WSUS is listening on. Default is ’80’ otherwise ‘8530’.

Parameters:
superseded = cleanup all superseded updates that are no longer needed.
expired = cleanup all expired unapproved updates.
obsolete = cleanup all expired updates regardless of their approval.
compress = cleanup previous revision of updates that are no longer deployable.
computers = cleanup computers that have not contacted the server in over 30 days.
files = cleanup unneeded content files.
DB = runs the database maintenance script (make sure the DB_maint.sql file is present).
all = if all is used all cleanup options above will be run.

Sample commands:
WSUSCleanupCL.exe SomeServer t 8530 all
The above command will connect to SomeServer on port 8530, use SSL and cleanup with all options.
WSUSCleanupCL.exe SomeServer f 80 computers superseded
The above command will connect to SomeServer on port 80, it will not use SSL and cleanup will only run the computers and superseded options (no other cleanup options will run).”

You can schedule this by just putting your command into a batch file and scheduling it to run whenever you like. To confirm the script has worked please check WSUS servers application event log for the below event.

image