2

So I have an upstream WSUS server which never ran the cleanup wizard. The content folder is around 800GB and there were also a lot of unneeded product categories enabled including drivers. As a first step I disabled unneeded categories and synced. Then I tried to run the cleanup wizard, which will run but not for the option Unused updates and update revisions. If this is checked the wizard will fail nearly immediately. wsusfail

The goal is to get the cleanup wizard to kick out uneeded updates so that the content folder will shrink and all replica servers won't have that much load.

For this I am following this guide.

There is a section HELP! My WSUS has been running for years without ever having maintenance done and the cleanup wizard keeps timing out.

Ensure you have a backup of the SUSDB then run a re-index. When that completes, run the following stored procedure in SQL Server Management Studio or SQL Server Management Studio Express. After this finishes, follow all of the above instructions for running maintenance. This last step is necessary because the stored procedure here only removes unused updates and update revisions.

Done so far

  • Re-index the database
  • Logged into WSUS with SQL Server Management Studio
  • Declined superseded updates with the script provided in the guide
  • Determine how many obsolete updates exist with this query on the DB EXEC spGetObsoleteUpdatesToCleanup

Not working

There is a SQL script which batch removes all uneeded updates. As a first step I tried to remove a single update from the spGetObsoleteUpdatesToCleanup table like this:

exec spDeleteUpdate @localUpdateID=224734

This gives the following error

Msg 50000, Level 16, State 1, Procedure spDeleteRevision, Line 33 [Batch Start Line 0]
@errorMessage
Msg 50000, Level 16, State 1, Procedure spDeleteUpdate, Line 72 [Batch Start Line 0]
spDeleteUpdate got error from spDeleteRevision

The SQL script for batch removing also fails with this errors.

How can I get the SQL script to batch remove uneeded updates so finally the cleanup wizard will run?

Also: shouldn't the number of declined updates correspond to the number of updates in spGetObsoleteUpdatesToCleanup?

Other resources:

duenni
  • 2,939
  • 1
  • 22
  • 38
  • 1
    Are you sure the built-in cleanup utility doesn't delete updates despite failing? I had these issues with about all Server 2008R2 WSUSs I managed. Sometimes I needed to run the wizard ~10 times and restart IIS from time to time, but it always deleted _some_ updates up to the point when the wizard ran without errors. I then started to script the cleanup and reindex to run regularly and never had issues again. – Lenniey Feb 12 '19 at 16:43
  • Yep, I'm sure. The wizard fails with the same error message, I can see it if i click on "Copy error message to clipboard" and also in the event viewer. I then run `EXEC spGetObsoleteUpdatesToCleanup` again and the number of rows in this table stays the same. Also rebooted and restartet IIS and WSUS service numerous times. – duenni Feb 12 '19 at 17:56
  • @duenni - Not sure, but it seems there is something in database which is not consistent! Can you try `wsusutil.exe reset` from elevated cmd/powershell, which performs operation on database as well! – Am_I_Helpful Feb 17 '19 at 17:16

0 Answers0