WSUS purge script, can be launched via a scheduled task
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # Cleanup Server $ServerName = "LocalHost" $UseSecureConnection = $False $port = 8530 [void][reflection.assembly] ::LoadWithPartialName( "Microsoft.UpdateServices.Administration" ) $wsusServer = [Microsoft.UpdateServices.Administration.AdminProxy] ::getUpdateServer( $ServerName , $UseSecureConnection , $port ) $cleanupInterface = $wsusServer .GetCleanupManager(); $cleanupScope = new-object 'Microsoft.UpdateServices.Administration.CleanupScope' ; $cleanupScope .DeclineSupersededUpdates = $True ; $cleanupScope .DeclineExpiredUpdates = $True ; $cleanupScope .CleanupObsoleteComputers = $True ; $cleanupScope .CleanupObsoleteUpdates = $True ; $cleanupScope .CompressUpdates = $True ; $cleanupScope .CleanupUnneededContentFiles = $True ; $cleanupInterface .PerformCleanup( $cleanupScope ) |
https://github.com/DavidWuibaille/WSUS/tree/main/CleanupServer
0 Comments