Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Region VARIABLES
- [String]$updateServer = "server.contoso.com"
- [Boolean]$useSecureConnection = $False
- [Int32]$portNumber = 80
- [Boolean]$supersededUpdates = $True
- [Boolean]$expiredUpdates = $True
- [Boolean]$obsoleteUpdates = $True
- [Boolean]$compressUpdates = $True
- [Boolean]$obsoleteComputers = $True
- [Boolean]$unneededContentFiles = $True
- #EndRegion VARIABLES
- #Region SCRIPT
- [void][reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration")
- $Wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer($updateServer,$useSecureConnection,$portNumber)
- $CleanupManager = $Wsus.GetCleanupManager()
- $CleanupScope = New-Object Microsoft.UpdateServices.Administration.CleanupScope($supersededUpdates,$expiredUpdates,$obsoleteUpdates,$compressUpdates,$obsoleteComputers,$unneededContentFiles)
- $CleanupManager.PerformCleanup($CleanupScope)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement