Windows Server Update Services (WSUS)
Removing superseded updates
With new updates being released regularly, more and more superseded updated accumulate over time. The files for those superseded updates consume a considerable amount of disk space after some time.
Superseded updates that have been approved for installation can be found by selecting approved updates in the "All Updates" view, adding the "Supersedence" column and then sorting for this column.
There are two ways to remove the files for those updates:
The first option is to decline them and then run the "Server Cleanup Wizard" (which can be found in the "Options" area). This method is described here. This method has the disadvantage that updates that might be needed in the future may be accidentally declined because the supersedence status is not 100% reliable (an update might only be superseded by another update for certain system configurations). One comment in the linked article suggests declining the updates, then running the cleanup wizard, and finally setting them back to "not approved".
The second option it to mark the updates as "Not Approved". However, this will not delete the associated files and there is no direct option to delete those files either. The only way is to remove all files in the WsusContent folder and then again downloading the files that are still needed. The WSUS service should be stopped before deleting the files and restarted after. After that, the WsusUtil.exe (which can be found in C:\Program Files\Update Services\Tools) should be run with the reset command. This will start the background process that downloads the needed files. This method is described here.
Regarding WSUS maintenance, there is another blog entry in the TechNet blog that describes maintenance tasks that should periodically be run on a WSUS server (e.g. re-indexing the database). It also provides some hints regarding what to do if the Server Cleanup Wizard keeps timing out.
In addition to the hints in that article, I found another trick: For me, the Server Cleanup Wizard was timing out when running the "Decline expired updates" action. I could fix this by running the spDeclineExpiredUpdates procedure from SQL Studio. I used "WUS Server" for the adminName parameter of this procedure. After that I ran the wizard again, and regenerated the indices. After doing this a few times, the wizard would finally complete without timing out. As always, make a backup of the SUSDB database before trying any of this.
My idea to run spDeclineExpiredUpdates was based on the ideas given in this thread.