Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $WsusServer = "localhost"
- $UseSSL = $false
- $PortNumber = 8530
- #Connect to the WSUS interface.
- [reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration") | out-null
- $WsusServerAdminProxy = [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer($WsusServer,$UseSSL,$PortNumber);
- #Create Object for WSUS Server
- $CleanUpScope = New-Object Microsoft.UpdateServices.Administration.CleanupScope
- #Define Scope for cleanup by setting on true / false
- $CleanUpScope.CleanupObsoleteUpdates = $true
- $cleanUpScope.CleanupObsoleteComputers = $true
- $cleanUpScope.CleanupUnneededContentFiles = $true
- $cleanUpScope.DeclineExpiredUpdates = $true
- $cleanUpScope.DeclineSupersededUpdates = $false
- $cleanUpScope.CompressUpdates = $true
- #create object for cleanup manager
- $cleanUpManager = $WsusServerAdminProxy.GetCleanupManager()
- #trigger cleanup
- $CleanUpManager.PerformCleanup($cleanupScope)
Add Comment
Please, Sign In to add comment