- Removing a corrupted Canon print driver - Fri, Apr 8 2016
- VMware vSphere licensing update 2016 – No love for the little guy - Fri, Mar 25 2016
- Veeam releases free Endpoint Backup 1.5 - Fri, Mar 18 2016
If you are like me and started your time with Windows back in the olden days (you know, before XP) you have probably noticed Windows now has a tendency to bloat badly over time. Further examination within the Windows directory will lead you to take a look at the WinSxS folder under C:\Windows, also known as the component store directory.
As an example as I write this article this directory on my test VM is currently at 17.1 GB, which is a bit much. Even worse, trying to manually just dump this directory will severely break your Windows installation. Well after a new patch released with the October batch, KB2852386, we now have a method to clean up unused updates in this directory and help to bring Windows back down to its fighting weight.
WinSXS folder size
Remember in XP when if you wanted to roll back a Windows Update you got prompted for the CD and then you had to find it or burn a new one or just give up? These days you don’t get asked for that anymore and WinSxS is why. What this directory does, among other things, is store all Windows updates ever installed on the computer even when they are superseded by others. When you need to do a rollback, Windows uses this as the source to pull the installers from, thus no CD needed. So that is what the WinSxS directory does for you.
WinSxS Cleanup ^
Now that you know what WinSxS is, how do we go about cleaning it up. First off you need to get the proper update installed. If you are doing this on a one off basis you can download the patch either directly here or run Windows Update making sure to look for KB2852386. In the enterprise this can be pushed via WSUS or other update mechanisms.
Once installed (no reboot needed) you have to run the Disk Cleanup utility. If you have UAC turned on and you did not choose to run the utility as an administrator you will need to click the “Clean up system files” button to have the utility to scan for this type of data, which will probably take a while to run.
Once the scan has run you will find a couple of new options, including Windows Update Cleanup and Service Pack Backup Files. As you can see from the screenshot from my test system, 17.1 GB, 6.32 can be cleaned up. Once you select all that needs cleaned up and hit ok, the utility will take care of getting rid of the clutter. You will notice that the next time you reboot Windows will act like it is processing new Windows updates and then cleaning up afterwards.
Automate cleanup ^
This is great and all, but I really don’t feel like repeating this process 100 times, let alone 1000+ as some of you might have to in your enterprise. Microsoft does provide a methodology automate the process of doing this cleanup for the enterprise, even if it is a bit clunky at present time. For detail on the process I’m going to point you to a great TechNet blog on this subject, but in essence the process goes like this:
- Run the command line version of Disk Cleanup from a test computer using a random number. For this example I will use 39. cleanmgr.exe /sageset:39
- This will launch a new Disk Cleanup window where you can make your selections of what to clean up.
- Once done, this will generate a new StateFlags0039 value within the plugin keys under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches in the registry. You can now export this values and distribute them via Group Policy or login script to the computers in your network.
- Now through whatever method of doing so like (for example Group Policy based Scheduled Tasks) you can now run cleanmgr.exe /sagerun:39 throughout your enterprise.
Note that on Windows 8 and Windows 8.1 computers the StartComponentCleanup scheduled task will automatically clean up the WinSxS folder.