Cleanup WSUS with PowerShell
Use this script to cleanup WSUS server. I schedule it to run once each week:
This file contains 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
$Port = "8530" | |
$Name = "WSUS" | |
$LogFile = "C:\WSUS_server_cleanup_log.txt" | |
Get-Date | Tee-Object -file $LogFile | |
Get-WsusServer -PortNumber $Port -Name $Name | Invoke-WsusServerCleanup -CleanupObsoleteComputers | Tee-Object -file $LogFile -append | |
Get-WsusServer -PortNumber $Port -Name $Name | Invoke-WsusServerCleanup -CleanupUnneededContentFiles | Tee-Object -file $LogFile -append | |
Get-WsusServer -PortNumber $Port -Name $Name | Invoke-WsusServerCleanup -CleanupObsoleteUpdates | Tee-Object -file $LogFile -append | |
Get-WsusServer -PortNumber $Port -Name $Name | Invoke-WsusServerCleanup -DeclineExpiredUpdates | Tee-Object -file $LogFile -append | |
Get-WsusServer -PortNumber $Port -Name $Name | Invoke-WsusServerCleanup -DeclineSupersededUpdates | Tee-Object -file $LogFile -append | |
Get-WsusServer -PortNumber $Port -Name $Name | Invoke-WsusServerCleanup -CompressUpdates | Tee-Object -file $LogFile -append | |
Get-Date | Tee-Object -file $LogFile -append |
Kommentarer
Send en kommentar