-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathClean-WSUS.ps1
More file actions
18 lines (17 loc) · 917 Bytes
/
Copy pathClean-WSUS.ps1
File metadata and controls
18 lines (17 loc) · 917 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Performs a cleanup of WSUS.
# Outputs the results to a text file.
# Adapted and tested by BigTeddy
# https://gallery.technet.microsoft.com/scriptcenter/WSUS-Clean-Powershell-102f8fc6
# 3 July 2012
$outFilePath = 'E:\Logs\wsusClean.txt'
[reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration") | out-null
$wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer();
$cleanupScope = new-object Microsoft.UpdateServices.Administration.CleanupScope;
$cleanupScope.DeclineSupersededUpdates = $true
$cleanupScope.DeclineExpiredUpdates = $true
$cleanupScope.CleanupObsoleteUpdates = $true
$cleanupScope.CompressUpdates = $true
#$cleanupScope.CleanupObsoleteComputers = $true
$cleanupScope.CleanupUnneededContentFiles = $true
$cleanupManager = $wsus.GetCleanupManager();
$cleanupManager.PerformCleanup($cleanupScope);