The WinSxS Folder Cleanup wizard allows you to regain a significant amount of disk space in Windows 7.
Follow me

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

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.

Disk Cleanup

Disk Cleanup

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.

After cleanup

After cleanup

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.

  1. Daniel Goneau 6 years ago

    Hi, I’m trying to get this to work… and have some questions.

    I don’t necessarily want to export all of the VolumeCaches Key, just the flags.

    I created a new GPO and have created about 10 new regs keys within the VolumeCaches (since it does create a few different subkeys depending on the option you chose). but it’s not cleaning my drive.

    I created a new scheduled task in the same GPO, but I don’t SEE it locally on the target computer in scheduled tasks… can you confirm if it shows up locally ?

  2. Zay 2 years ago

    Try running this on one of the computers schtasks /query /TN "name_of_task_you_created". If you are not sure of the name of the task, then just run schtasks /query and it will show all tasks on the machine. 

Leave a reply to Zay Click here to cancel the reply

Please enclose code in pre tags

Your email address will not be published.


© 4sysops 2006 - 2022


Please ask IT administration questions in the forums. Any other messages are welcome.


Log in with your credentials


Forgot your details?

Create Account