WSUS Cleanup Script

Here is a handy little script that cleans up WSUS 3 Automatically

[reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration") | out-null 
 $wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer(); 
 $cleanupScope = new-object Microsoft.UpdateServices.Administration.CleanupScope; 
 $cleanupScope.DeclineSupersededUpdates = $true 
 $cleanupScope.DeclineExpiredUpdates = $true 
 $cleanupScope.CleanupObsoleteUpdates = $true 
 $cleanupScope.CompressUpdates = $true 
 #$cleanupScope.CleanupObsoleteComputers = $true 
 $cleanupScope.CleanupUnneededContentFiles = $true 
 $cleanupManager = $wsus.GetCleanupManager(); 
 $cleanupManager.PerformCleanup($cleanupScope);

3 Comments

  • Hi, What should this GFi script be saved as? .?

    Thanks

  • No matter whether there is snow on the ground or bright sunlight shining down, New Jersey is a beautiful place to look at, and an ever better place to call home. Perhaps this is why home values in New Jersey remain so high, not because of their size or shape, but because of the nature of community within the borders.

Leave a Reply

Your email address will not be published.