.\Matthew Long

{An unsorted collection of thoughts}

Posts Tagged ‘Windows 7’

Cleaning up Windows 7 / Server 2008 R2 Service pack 1 Files

Posted by Matthew on March 4, 2011

I’ve recently been updating various computers, wim images and virtual machines with NT 6.1 Sp1 (Windows 7 and Server 2008 R2).  As many people may have noticed before, this once again means you can expect a large jump in the size of your Side-By-Side repository (the C:\Windows\Winsxs).  Unlike with Vista and Server 2008 SP1/SP2 there is no cleanup tool provided with the service pack.  This is because DiskCleanup / DISM are already provided for you to do this.

So what does this involve?  Removing the service pack backup files will essentially remove all of the superseded files and libraries that the service pack updated, at the cost of now being unable to remove the service pack (as you cannot roll back to the superseded versions).  The amount of space you will recover can vary but is usually between 1-2gb.  That isn’t a lot for end-user machines, but that can be huge when you are looking at machine images and virtual environments.  Obviously you should thoroughly test your machines / images before committing to such an endeavour. 

There are essentially two ways to complete this process.  If you have access to the Disk Cleanup tool (Windows 7 or Windows Server 2008 R2 with the desktop experience pack installed) you can run that, click on the “Cleanup System Files” button (requires user elevation) and when the tool re-opens select “Service Pack Backup Files”.

If you don’t have Disk Cleanup installed, or are working with an offline WIM image, you are going to need to use DISM.

  1. Start an elevated command or Powershell prompt (Run as Administrator)
  2. If you are servicing this machine, enter dism /online /cleanup-image /spsuperseded /hidesp to cleanup the online computer.  If you want to cleanup an offline wim image, instead enter dism /image:wimfile.wim /Cleanup-Image / spsuperseded /hidesp.  The /hidesp option will remove SP1 from the “Installed Updates” section of Programs and Features, to ensure that users do not try to uninstall the service pack.  
  3. DISM will now remove backup files and superseded components from your machine.  When finished, you should have the below output :
dism /Cleanup-Image /spsuperseded /hidesp results
dism /Cleanup-Image /spsuperseded /hidesp results

And that’s it, your done!


Posted in Computing | Tagged: , , , | 2 Comments »