Wednesday 26 July 2017

Windows Update Cleanup missing from Disk Cleanup - Windows 2008R2

Background:
Your server is full, or at least one disk is. You've tried the usual things:
  • Sift through the *.tmp files
  • Clear out any history/downloWindows ads/cookies etc from your browser
  • Save & Clear the main logs (system, applicaiton etc) in Event Viewer

Finally you check the Windows Component Store (C:\Windows\WinSXS) and find it's huge. Thus, you'll need to clear it down but don't start trying to manually delete stuff since a lot of these files are used by the OS.

To clear up this folder in Win2012 onwards, you can just use Disk Cleanup and tick the Windows Update Cleanup box but for 2008R2 you'll need to install a patch to add in the Windows Update Cleanup Option.

Install KB2852386 - this gives extra functionality to the Disk Cleanup wizard which includes the ability to remove all old Windows Update files (i.e. a good portion of the WinSXS folder).

Problem:
In spite of having installed the patch, you open disk cleanup only to find Windows Update Cleanup is not appearing on the Disk Cleanup list. Sad times. 

Solution:
To get round this, open up an elevated CMD prompt and use the Cleanup Manager via this code:

Cleanmgr /sageset:1
 
(NB you can choose any number between 1 and 65355).
 
You'll now get a pop up which allows you to select all the things you want to clean for this iteration of CleanMgr. 
Click OK to save it.
 
Then in the cmd prompt enter:

Cleanmgr /sagerun:1

and your custom clean job will tick over.
 
You can even save the cleanup job to your desktop or stick it in a scheduled task with the following cmd line:

%systemroot%\system32\cmd.exe /c Cleanmgr /sagerun:XXXXX
 

No comments:

Post a Comment