.\Matthew Long

{An unsorted collection of thoughts}

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!

About these ads

2 Responses to “Cleaning up Windows 7 / Server 2008 R2 Service pack 1 Files”

  1. thesav said

    How do you do this to an offline image?

    • Matthew said

      Hi,

      The second half of step two talks about how to do this to an offline image file. I’ve copied the relevant text and placed it below :

      If you want to cleanup an offline wim image, instead enter
      dism /image:wimfile.wim /Cleanup-Image / spsuperseded /hidesp.

      Hope that’s what you are looking for.

      Kind regards,

      Matthew

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.