How to delete old updates from WSUS server

  • Home
  • Anonymous
  • Sign in to post
  • Post
  • Explore
  • Tags
  • Questions
  • Site feedback
  • Articles
  • Users

Skip to main content

How to delete old updates from WSUS server

    • Tags
    • Questions
    • Site feedback
    • Articles
    • Users
  • Sign in to post

  • Home

question

Greetings,
We have a bloated WSUS full with AMD and other rubbish.
Can we manually delete a bunch of updates direct from WSUS using powershell if that WSUS is a SUP for MEMCM?
Will CM work out stuff no longer exists and automatically delete metadata stored in its system? Or will the metadata hang around?
If so, can the CM metadata be deleted?

Thanks
David Z

mem-cm-generalwindows-server-update-services

This is actually what WSUS Automated Maintenance (WAM) does with declined updates, and Drivers.

The WAM removes 'obsolete' updates. How is 'obsolete' defined?

Microsoft's APIs, but that's not just what I was referring to. WAM also removes declined updates quarterly from the database - using PowerShell's APIs.

You are talking about a third party product?

Yes, Full Disclosure - Mine.

My point was to indicate/demonstrate that you can do that to which you asked. WAM is used with many installs of SCCM and as it does the cleaning out that you're talking, you are able to do this yourself if you wish.

No use to me. I can write powershell to delete stuff myself. I just wanted to know the implications as per my original question.

My intention was to let you know that you can do it and since WSUS feeds SCCM, it will eventually remove it from SCCM's database too (as per the 7 days expiry mentioned below).

0 Votes 0 ·

Ive seen powershell scripts that delete updates from WSUS.

Either the scripts are mischaracterizing themselves or there's a disconnect here in exactly what you want. You can certainly run the cleanup wizard to remove old revisions of updates and that's what these scripts you are referencing do. Running the cleanup wizard is built into ConfigMgr. So, the question here is what exactly are you trying to delete and why?

0 Votes 0 ·

Even though we try and run the cleanup wizard every month and rebuild the indexes regularly, we still get the old 'reset server node' regularly when trying to do stuff. Whats the point of having all those stupid AMD things in the database at all? and x86?

the old 'reset server node'

What exactly is this and where are you seeing it?

0 Votes 0 ·

You try and do anything in the console like view updates or run the cleanup wizard and they time out most of the time. You are left with a button that says Reset Server Node.

0 Votes 0 ·

This is a known behavior and is caused by a timeout in the cleanup wizard. You can either initiate the cleanup from code or keep running the cleanup wizard until it does actually succeed.

0 Votes 0 ·

Also, for AMD updates, simply decline them.

0 Votes 0 ·

Declining updates does not delete them. We want them gone to improve the WSUS performance.
btw - we have two WSUS servers - one is standalone and therefore does not have MEMCM ability to delete updates. This is where I want them deleted.
Heres a script that will delete declined updates:
[reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration")
$wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer();
$declined=$wsus.GetUpdates() | Where {$.IsDeclined -eq $true}
$declined| ForEach-Object {$wsus.DeleteUpdate($.Id.UpdateId.ToString()); Write-Host $_.Title removed }

0 Votes 0 ·

This isn't a good choice. It's not exposed in the WSUS console for a reason.

Perf issues in WSUS often come down to the SQL DB. Is your WSUS instance using an actual SQL instance or the WID?

Also, I think you are incorrectly conflating symptoms here. Declining updates absolutely increases perf as the update is no longer included in the update catalog. And as noted, your console issue isn't a perf issue, it's a built-in time limit which was hard-coded 15 years ago long before WSUS handled even a small fraction of what it does today.

Finally, ConfigMgr does not delete updates from WSUS.

0 Votes 0 ·

Show more comments

There's no mention in that guide of deleting updates for a reason, it's not a good idea. My guess is that the next time you sync the catalog from Microsoft, they'll just be re-created anyway. That guide specifically calls out declining them.

1 Vote 1 ·

question details

How do I clean up WSUS files?

In the WSUS administration console, select Options, and then Server Cleanup Wizard. By default this wizard will remove unneeded content and computers that have not contacted the server for 30 days or more.

How do I manually clean WSUS?

Clean Up WSUS.
net stop wsusservice. cd "C:\Program Files\Update Services\Tools".
wsusutil. exe reset. echo Delete WSUS Folder Content..
pause. net start wsusservice..