Created
September 2, 2014 14:57
-
-
Save rdark/41d73f3e5dacaca7f18d to your computer and use it in GitHub Desktop.
automate clean up of WSUS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Script to clean up WSUS database | |
| [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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment