EDIT: This command only works with Windows Server 2008 R2 SP1. DISM is available to use, but some of the switches and functionality isn’t available until SP1.
We generally keep the OS partition of our VMs as small as possible. Windows 2008 is great in that we can always increase the size of a drive later on, need be. When our monitors alerted us about low disk space on our vCenter Server I was a little confused. The vCenter server doesn’t do much on a day to day basis and really doesn’t see a increase or decrease is space.
As it turns outs, the winsxs folder was growing. The winsxs folder (located at C:\Windows\winsxs holds temp backup files for Windows Updates. You’ll find this folder in most, if not all, versions of Windows – from Server 2008 to Vista and 7. When I discovered the folder, it had grown to about 9GB.
You should not delete this folder. Its existence is important. That said, the contents in the folder may be important later on. This isn’t like deleting temporary internet files. Instead, take a look at the command below. Open up a command prompt as an administrator and run the command below. It will clean up your service pack updates and reduce the folder size considerably.
dism /online /cleanup-image /spsuperseded
Running this script takes about two minutes. When I ran this on a 9GB folder, my folder size dropped to just above 6GB. That’s a pretty darn good cleanup, comparatively.
DISM (Deployment Image Servicing & Management) has a number of different maintenance features for your images. The cleanup that we did is just one of the services. Take a look at the rest of the DISM tools to see if it can help you elsewhere.