WinSxS and reclaiming space

Written by Marcos Velez:

So, some months back I ran into space issues with an internal web server and came across this monstrosity called the WinSxS folder.  At the time, I did all the research I could and learned all too well this folder is a source of frustration for many, many admins.  I also learned there is little that can be done about it, and that messing with its contents is highly discouraged with the usual warnings that it could screw up your system.  ScreenClip

Beyond many uneducated guesses by frustrated Windows admins, and even murkier recommendations to delete things by means of really shady scripts, there was little a person could do to alleviate the space issues associated with the ever-increasing size of this folder.  If you are running Windows Vista (really!?) you can use vsp1clean.exe, and if you have Windows 7 or Windows 2008, you can run compcln.exe.  But, what do you do if you have Windows 2008 R2?  I finally came across a very good solution that reclaims quite a bit of space (more than the compcln.exe utility) and which is available in all Windows 2008 R2 installations.  It is called DISM, which stands for Deployment Image Servicing and Management.  It is meant to manage and administer Windows images, but it does a great job managing an actual Windows installation already in use.  The following command line will do everything that compcln.exe advertises, and it does so efficiently:

dism /online /cleanup-image /spsuperseded /hidesp

For those interested in reading up some more on DISM, here is the technet reference:

In any case, some of you may already be familiar with this tool, but it was certainly new to me, and it has helped me tremendously to clean up a few servers.  I hope you find it as useful.