An often asked question is how to reclaim space after a service pack installation. We've talked about VSP1CLN and COMPCLN for Windows Vista and 2008. Now that SP1 is out, it's time to talk about how to do this on Win7/R2. It's a DISM command now:
DISM.exe /Image:C:\test\offline /Cleanup-Image /spsuperseded /hidesp
NOTE: This command is from the help file and might not be the command you need. For example, if you're running against an online installation, the command is dism /online /cleanup-image /spsuperseded
You can also use the disk clean up wizard to remove the service pack files.
Of course, either of these will make the service pack permanent which means that you cannot uninstall it from the system once you do this. So, use this with caution. As in previous cleanup commands, this will remove any superceded package from the system on the next scavenging pass and reclaim your space. Feel free to ask questions if you have them.
Why does the command keep changing with (wait, not even every OS but) every service pack!!!! Good gracious this is horribly annoying esp with such a long command!! Sorry to troll but ease of use fail. Does this command do the same thing as what this image shows: windowsteamblog.com/.../win7_5F00_sp1_5F00_cleanup.jpg and if yes then why is the command so long with so many switches?
It looks like the command you posted would work on an offline image and one would want to use /online to use it on a running system with 7 SP1.
Good point, the command can be run on or offline, I just used the dism command from the help to make it easier.
As for the command changing, I think thats mostly due to the fact that we created a tool for the first two service packs to allow this to happen. This is more of a functionality of DISM now, so I would hope that this would be the standard moving forward. Time will tell I guess.
BTW, I can see the jpg you're pointing to in the comment so I cant tell you if its the same or not. The tool just makes the service pack uninstallable and removes any instance of files that were replaced as part of the service pack install.
Is the a similar command for ImageX? Or can I use the same for it (with imagex instead of DISM of course)?
You can use the same command against an offline WIM.
Ok, a tool for removing SP uninstall files on Windows Server 2008 R2. Great!
How about a tool for cleaning up hotfix/patch uninstall files on Windows Server 2008 R2? Sorry to redirect but I have been searching the web and technet all day and only finding references to cannot delete winsxs and use compcln on windows 2008. There is no compcln on R2.
We do that automatically in R2 already. We have a scavenging process that runs at different time intervals to remove updates that have been superceded. So in other words, your component store is already at its smallest (or close to smallest) size.
Are you seeing some sort of specific issue?
Joseph, Thanks so much for your response. The specific issue is that my windows directories on my Windows 2008 R2 servers are growing at an unprecidented rate. Since I have the ability to uninstall all of the patches that have been installed to my machines my assumption is that the uninstall files must still be present. Over the last few years I have only needed to uninstall a patch 3 or 4 times. We have a fully patched environment, so unless a patch breaks needed functionality, it gets installed and stays installed. For those few patches that have broken functionality, they have been removed promptly. It is true that new servers come with larger disk drives, but in my environment not all new servers are physical. My VM's use costly shared storage that doesn't grow with every new server deployment. It is amazing how fast a couple of terrabytes can disappear when you are allocating 40GB per to servers that require little or no file storage. 40GB for a DHCP server seems to be unreasonable.
Can you describe what you mean by an unprecedented rate? Exactly how large are you component store directories?
sorry for hijacking your blog. To simplify things and not create an extended thread in your comments; We can remove service pack uninstall files, right? That is great, and much appreciated. Based on your comments it appears there is no tool to remove uninstall files for individual patches.
LOL, dont worry about it, that's what its here for.
To answer your questions, yes, you can remove the service pack files for SP1 but doing so makes the service pack permanent (you can not uninstall it). You're also correct that you dont have a means to remove the superseded files for individual patches but again, we do some of that automatically for you now anyways so its not the same problem as it would be in 2008/Vista.
Never got this working on an offline image. How should the sp1 be integrated and how exactly should the offline image path be in this command? Why theres no index parameter?
Sorry buts somethings wrong here, not?
Service Packs can not be integrated in Vista ++ operating systems. So in your case Chris, you'll need to do an online installation, install the service pack, remove the uninstall files, sysprep the image and then capture it.
Ok, so I can't apply SP1 to an install.wim from the media? Bummer.. I've got a domain controller image on the install.wim file (ie: sbs2011 source), and once installed, it can't be sysprepped... so is there any way to slip-stream the SP1 bits onto it pre-install?
No, there is not.