WSUS Server Cleanup
Description:
Follow these steps to clear WSUS server updates that are bloating the server.
To Resolve:
Update 2017-10: I don’t bother with native Windows WSUS cleanup as it doesn’t do anything worthwhile. Instead, download the WSUS clean up script (link removed => lookup adam wsus).
-
Set the email variables from lines 607-629
-
Optionally add the line “[System.Net.ServicePointManager]::ServerCertificateValidationCallback = { return $true }” After line 3247
-
Place in C:\scripts
-
Open admin shell and type “Set-Executionpolicy bypass”
-
Type “.\clean-wsus.ps1 -FirstRun”
- This will run the script and install the scheduled task.
-
Now type: “Set-Executionpolicy RemoteSigned”
- For an ad hoc clean, I usually run something like my script here.
-
Make sure the option: “Download update files to this server only when updates are approved” is checked
-
Disapprove any unwanted updates.
-
Close any open WSUS windows and stop the Update Services service.
-
Delete ALL files and folders in the WSUSContent folder (C:WSUSWsusContent on my machine)
-
Start the Update Services service.
-
Open a command prompt and navigate to the folder: C:Program FilesUpdate ServicesTools and type: WSUSUtil.exe RESET
-
You could create a script in Powershell v5 that you can set to run automatically:
Invoke-WsusServerCleanup -CleanupObsoleteComputers -CleanupObsoleteUpdates -CleanupUnneededContentFiles -CompressUpdates -DeclineExpiredUpdates -DeclineSupersededUpdates
Comments