WSUS cleanup - timeout when deleting "unneeded update files"

Performing WSUS cleanup which hasn't been done for quite a while - running the cleanup-wizard with the only selected option being "unneeded update files":

enter image description here

After about three minutes of processing, the wizard crashed due to a timeout-exception: enter image description here

This is the message I press "copy to clipboard" in the console:

The WSUS administration console was unable to connect to the WSUS Server via the remote API. 

Verify that the Update Services service, IIS and SQL are running on the server. If the problem persists, try restarting IIS, SQL, and the Update Services Service.

System.Net.WebException -- The operation has timed out

Source System.Windows.Forms

Stack Trace:
at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)
at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)
at Microsoft.UpdateServices.UI.SnapIn.Wizards.ServerCleanup.ServerCleanupWizard.OnCleanupComplete(Object sender, PerformCleanupCompletedEventArgs e)

...tried the same thing in an elevated instance of PowerShell: enter image description here


What I have tried so far:

  • Since the timeout period appears to be ~3mins I have set the connection timeout of the Wsus-Site in IIS from 180sec to 10800sec: enter image description here

  • made sure the Account associated with the IIS-ApplicationPool has sufficient permissions on the WSUSContent folder

  • made sure the account I'm running the wizward/script is a member in the WSUS administrators group (and administrators group of the server)

  • disabled the query timeout on the SQL-Server my SUSDB is running on (originally did this while cleaning unused updates and update revisions)

All other WSUS cleanup steps are working - initially I had a few hiccups while cleaning "unused updates and update revisions" as the cleanup hadn't been performed for a long time. However, after manually deleting a few updates from the database and disabling the timeout that step completed without errors. I should also mention the WSUS server is part of an SCCM-environment and it's managed by our SUP (cleanup on scheduled update sync is enabled).

Looking around the forums I've found several helpful threads dealing with timeouts while cleaning up "unused updates and update files", but I have not found much about the same problem while cleaning "unneeded update files". So any help would be appreciated here.


This script is old, but I've had good luck running it on my WSUS server. I inherited one that was completely out of control and the console would crash at various places. I also run this reindex WSUS database script as well, which might help.

I've been running these as nightly maintenance ever since.