Blog

WSUS Cleanup Script

Here is a handy little script that cleans up WSUS 3 Automatically

1
2
3
4
5
6
7
8
9
10
11
[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);

Posted in: Scripts, Technical

Leave a Comment (3) ↓

3 Comments

  1. Alan April 5, 2013

    Hi, What should this GFi script be saved as? .?

    Thanks

    reply
    • wpadmin April 12, 2013

      This script is powershell. should be saved as a .ps1

      reply
  2. sprzedaj May 23, 2017

    No matter whether there is snow on the ground or bright sunlight shining down, New Jersey is a beautiful place to look at, and an ever better place to call home. Perhaps this is why home values in New Jersey remain so high, not because of their size or shape, but because of the nature of community within the borders.

    reply

Leave a Comment