WSUS Cleanup - can this be done is phases?

We've recently noticed performance issues with our SCCM clients when downloading Endpoint updates so we've been advised my Premier Support to run a WSUS cleanup.  The problem I have is that we have never run a clean up before and when I tried it in test it took hours and hours to complete (it crashed via the GUI so I have been given a SQL script).

The performance should definitely be better on our production boxes however I'm unable to obtain a maintance window long enough to complete the work.  I need to run it on our two Primarys and CAS.  Is there any way of staging the clean up so that I can do small amounts gradually over a few weeks, rather attempting to do all three servers over a weekend?

I'd be grateful if anyone could let me know.

Thanks 

June 24th, 2015 6:18am

You can perform a cleanup only on a per-database basis, but not gradually for each database. Such a script should run for a couple of minutes only (up to some hours  maybe).
Free Windows Admin Tool Kit Click here and download it now
June 24th, 2015 6:24am

OK Thanks Torsten.  It's picked up something like 6000 obsolete objects in the test environment and has taken over 24 hours to delete them.  I know this is test, but even so.  I do not have anywhere near that amount of time to complete this work before I'm unable to touch the server because it's being used for other deployments.  It's a shame that you can't delete in sections, even if it had to be done manually.

  • Edited by LinJack 20 hours 34 minutes ago
June 24th, 2015 6:31am

I've never seen it taking so long. What SQL command are you using to clean up the database? I guess that it's using a cursor to delete items one by one. That can be modified to clean up smaller batches then. 
Free Windows Admin Tool Kit Click here and download it now
June 24th, 2015 7:47am

This is the query

DECLARE @var1 INT

DECLARE @msg nvarchar(100)

 

CREATE TABLE #results (Col1 INT)

INSERT INTO #results(Col1) EXEC spGetObsoleteUpdatesToCleanup

 

DECLARE WC Cursor

FOR

SELECT Col1 FROM #results

 

OPEN WC

FETCH NEXT FROM WC

INTO @var1

WHILE (@@FETCH_STATUS > -1)

BEGIN SET @msg = 'Deleting ' + CONVERT(varchar(10), @var1)

RAISERROR(@msg,0,1) WITH NOWAIT EXEC spDeleteUpdate @localUpdateID=@var1

FETCH NEXT FROM WC INTO @var1 END

 

CLOSE WC

 

DEALLOCATE WC

 

DROP TABLE #results

June 24th, 2015 7:59am

OK Thanks Torsten.  It's picked up something like 6000 obsolete objects in the test environment and has taken over 24 hours to delete them.  I know this is test, but even so.  I do not have anywhere near that amount of time to complete this work before I'm unable to touch the server because it's being used for other deployments.  It's a shame that you can't delete in sections, even if it had to be done manually.

  • Edited by LinJack Wednesday, June 24, 2015 11:11 AM
Free Windows Admin Tool Kit Click here and download it now
June 24th, 2015 10:30am

Yes, I know this is an old post, but Im trying to clean them up. Did you solve this problem, if so what was the solution?

That SQL looks similar to Kent's blog post.

http://blog.coretech.dk/kea/house-of-cardsthe-configmgr-software-update-point-and-wsus/

I find that the SQL script that Kent's post can take hours/days to complete and you might need to run it multiple times to clean up all the data.

August 22nd, 2015 11:01am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics