Auto cleanup WSUS server

Hi All,

One of the main issues we as SysAdmin experience with WSUS servers is the disk utilization that utilizes for downloading updates,  in most cases my customers are notified to the disk warning only when they receive an alert about disk spaces or getting Windows update error on some machines.

The growth frequency of WSUS disk depends on your classification and product settings you allowed to download which means as much as you allowed the disk capacity will grow, make sense right?.

When we have a single WSUS server we definitely can control this and ran the cleanup manually once a month isn’t so awful, If you have one WSUS server is not so awful to run auto-clean once a month manually, but what if you have multiple WSUS servers? it is more difficult and troublesome, therefore, I would suggest run the following script and insert it into Task Scheduler

Get-WsusServer -Name WSUSSERVERNAME -PortNumber 8530 | Invoke-WsusServerCleanup -CleanupObsoleteComputers -CleanupObsoleteUpdates -CompressUpdates -CleanupUnneededContentFile -DeclineExpiredUpdates -DeclineSupersededUpdates

Would you like to get a log?

Add this:

| Out-File C:\WSUSSCRIPT\cleanup_wsus.log