Analyze and clean the WinSXS folder

Martin Brinkmann
Mar 14, 2016
Updated • Sep 4, 2019
Windows
|
37

We have talked in length about the WinSXS folder back in 2010 and how it comes up regularly as one of the largest folder on the computer when storage is analyzed using tools like WizTree.

Windows Explorer and third-party programs report a size of several Gigabyte at the very least, but the count can go up to ten and more Gigabytes depending on the system it is analyzed on.

WinSXS, the full path is c:\Windows\WinSXS\ if Windows is installed on the c: drive, contains files that are required for servicing operations such as the installation of updates, service packs or hotfixes.

According to Microsoft, the component store contains "all the files that are required for a Windows installation", and since it also holds files added by updates, it grows over time on all systems.

The size of the folder is not reported correctly however if you use Windows Explorer or third-party tools like WizTree to analyze its size.

The reason for that is that it contains hardlinks which Explorer and third-party tools don't take into consideration when calculating the WinSXS folder's size (they count the hardlinked files even though they don't reside in the WinSXS folder).

These hardlinks point to files in other Windows directories, for instance c:\Windows\system32.

Analyzing the WinSXS Folder

winsxs folder analyze

A proper way to analyze the Window WinSXS component store directory is to use dism.exe.

Deployment Image Servicing and Management (DISM) was introduced by Microsoft in Windows Vista and has been part of new versions of Windows ever since.

Update: Please note that the commands will only work on Windows 8 or newer machines.

Here is what you need to do to analyze the WinSXS Folder:

  1. Tap on the Windows-key, type cmd.exe, hold down Shift and Ctrl, and hit the enter key on the keyboard. This opens an elevated command prompt on the system. If you have troubles getting this to work, right-click on the cmd.exe result instead and select "run as administrator".
  2. Run the command dism.exe /Online /Cleanup-Image /AnalyzeComponentStore

The parameter /Online refers to the current installation, and /Cleanup-Image /AnalyzeComponentStore is the command to analyze the current component store of that installation (the WinSXS folder).

You can list all available commands using dism.exe /?, and subsequently dism.exe /Online /? and dism.exe /Online /Cleanup-Image /?.

The command runs a scan that takes a moment to complete. It echoes the Windows Explorer size and actual size to the command prompt window, and gives recommendations whether it makes sense to run a cleanup operation. If you proceed with the cleanup, see below for instructions, it is advised to run the analysis again after the cleanup operation completes to find out how much smaller the folder has become.

The command echoes the actual size of the folder as well which may be very useful as it highlights usually that the component store is not as large as third-party programs or Explorer make it appear to be.

Cleanup

Windows runs a cleanup regularly using the Task Scheduler. You can check if that is the case on your machine in the following way:

  1. Tap on the Windows-key, type Task Scheduler and hit enter.
  2. Navigate to Task Scheduler (local) > Task Scheduler Library > Microsoft > Windows > Servicing > StartComponentCleanup

You can run the cleanup operation manually at any time using the following command using an elevated command prompt:

dism.exe /Online /Cleanup-Image /StartComponentCleanup

It is usually not necessary to run a cleanup unless the AnalyzeComponentStore analysis recommends it.

You can however use Disk Cleanup to free up disk space, and run an analysis afterwards to remove files from the WinSXS folder that are no longer required.

Basically, if you remove previous versions of Windows then you may end up with components in the WinSXS folder that are no longer required because they were valid only for the previous version of Windows.

Frequently asked questions

Why is the WinSXS folder so big?

Most programs report an incorrect size for the WinSXS folder because of hardlinks. Hardlinks point to other locations on the device.

Should I clean up of the WinSXS folder?

It is usually not necessary to clean up the folder manually as Windows does so automatically on schedule.

Now You: How big is your system's WinSXS folder?

Summary
Analyze and clean the WinSXS folder
Article Name
Analyze and clean the WinSXS folder
Description
Find out how big the WinSXS folder really is, and if it makes sense to run a cleanup command to remove files from it that are no longer needed.
Author
Publisher
Ghacks Technology News
Logo
Advertisement

Tutorials & Tips


Previous Post: «
Next Post: «

Comments

  1. brightspark said on March 23, 2016 at 11:32 pm
    Reply

    @Pants

    You need to lighten up mate. John Krazinski’s comment is quite funny really. There is always room for a little humor, is there not?

  2. Fred said on March 15, 2016 at 7:35 pm
    Reply

    Hi all,

    I finaly write here now, because i like this website, usefull information here about Pc.
    Many ask how to clean Windows 7 WinSxs.
    Microsoft release an add on for the defaut Windows Cleanup , with this update kb2852386.
    It add a option to clean all obsoletes updates.

    all information here
    https://support.microsoft.com/fr-fr/kb/2852386

    1. melodikmusic said on July 6, 2016 at 1:48 am
      Reply

      This update does not work, I have it installed and it does not show system files or old installations to be cleaned even my windows 7 folder is 25gb with an winsxs folder of 9gb which is so big for my taste.

    2. some said on May 29, 2016 at 8:41 pm
      Reply

      I’m not sure what this kb does exactly, but it surely doesn’t cleanup the winsxs directory. (win7 ultimate x64), confirmed on 2 stations.

    3. silat said on March 16, 2016 at 7:42 pm
      Reply

      Fred here is the English link: https://support.microsoft.com/en-us/kb/2852386

  3. ann said on March 15, 2016 at 11:30 am
    Reply

    As a sysadmin for several companies, i’ve even seen winSXS folder reporting more size than the actual disk.
    this indeed due to many hardlinks to the same files.
    25 GB disk with 30+GB winsxs.
    yeah that was an extreme case having several service packs installed with a volatile temp space.

    you can’t use the supplied dism on old systems to clean up, but you can put the new dism on it and use that one to clean up.
    DISM

    This topic introduces the DISM cmdlets available in the DISM PowerShell module. This module is available in Windows® 8.1 and Windows Server® 2012 R2. On other supported operating systems, you can install the DISM module from the Windows Assessment and Deployment Kit (Windows ADK). For more information about how to use the DISM PowerShell module installed with the ADK, see How to Use DISM in Windows PowerShell.

  4. albresc said on March 15, 2016 at 11:10 am
    Reply

    Not working here… error 87 (Windows 7 Pro EN SP1 x64)

    Only this:

    dism /online /cleanup-image /spsuperseded

    more here
    https://blogs.technet.microsoft.com/joscon/2011/02/15/how-to-reclaim-space-after-applying-windows-72008-r2-service-pack-1/

  5. Jeff said on March 15, 2016 at 5:22 am
    Reply

    Martin, try the ResetBase parameter for DISM to free up even more disk space.

    1. Steve said on March 15, 2016 at 9:49 am
      Reply

      Jeff, yes…but be careful, after running DISM with the “/ResetBase” parameter you cannot go back and uninstall previously installed updates. Do this only if very sure of your backup system, or when certain that you won’t want to uninstall any previous MS updates.

      1. Jody Thornton said on November 30, 2017 at 4:53 pm
        Reply

        I’m trying to find out if there is a way to mimic the /Resetbase option in Windows 8 (as in the original) It appears that the /Resetbase and /AnalyzeComponentStore options were brought about in Windows 8.1.

  6. o_O said on March 14, 2016 at 8:54 pm
    Reply

    win7 folder with all updates excluding telemetry and stuff: 31.8gb

  7. JonnyRedHead said on March 14, 2016 at 5:54 pm
    Reply

    How do we do this on Windows 7 x64 for the WinSXS folder?

    1. plaidon said on March 15, 2017 at 10:33 pm
      Reply

      Had the same problem on Win7.
      Fortunaltely I found
      Dism++
      Freeware

      1. Jeff-FL said on March 15, 2016 at 1:48 pm
        Reply

        Thanks Corky.

      2. Corky said on March 15, 2016 at 11:58 am
        Reply

        @Jeff-FL, I could be wrong and would be happy to be corrected but AFAIK Error 87 is just reporting that there’s nothing to clean up as it’s already been done, probably via Windows disk cleanup utility that i think does what the same thing as this DISM command on Windows 7, AFAIK all this command does on Windows 7 is clean up any unneeded files left over from when SP1 was installed, assuming you have no plans to role back to a pre-SP1 state.

      3. Jeff-FL said on March 14, 2016 at 10:03 pm
        Reply

        @Moloch, that only cleans up service pack backup files.

    2. Jeff-FL said on March 14, 2016 at 6:40 pm
      Reply

      I’d like to know this too. I get Error 87. As others have said, part of the cmd line parameters weren’t introduced until Win 8.1. So how do we run this on Win 7?

    3. Big Maq said on March 14, 2016 at 6:34 pm
      Reply

      Same question here…got the “Error: 87” reported above.

  8. Paul(us) said on March 14, 2016 at 5:33 pm
    Reply

    Windows 7 pro. 64 bit:
    The winsxs folder has: 88.526 files and is a whopping 22.4 GB.
    49,594 files (56%) goes to others, 33.312 files (37,5%) to Manifests, 3.282 files (3,7%) to backup and 2.438 files (2,8%) to catalogs.

    1. Haakon said on March 14, 2016 at 7:17 pm
      Reply

      Windows 7: enter dism /?

      No cleanup options.

      Use caution with utilities like Disk Cleaner and others like it. WinSXS became much friendlier in 8.

      No Task Scheduler Servicing either.

  9. Henk van Setten said on March 14, 2016 at 5:33 pm
    Reply

    Good work highlighting this here for us. I had never heard of this tool before, so gave it a try right away.

    On my Windows 8.1 x64 system, the Dism command reported a “Windows Explorer Reported Size of Component Store” of 7.12 GB, and an “Actual Size of Component Store” of 6.96 GB. So just like in Martin’s example output in the above post, the difference between reported and actual size was in fact rather small.

    At the same time, my actual WinSxS does seem quite a lot larger than Martin’s: it’s 6.96 GB on my disk, but only 4.12 on his! Maybe this is because his system was installed recently, while mine has already been chugging along for a couple of years?

    In my case, the actual size of 6.96 comprised 5.02 GB “shared with Windows”, 1.62 GB “Backups and Disabled Features”, and 0.3 GB “Cache and Temporary Data”.

    Interestingly, even though a scheduled cleanup had been done 10 days ago, the Dism result advised me to run a cleanup. So I did, and even more interestingly, after running up to 100% this cleanup produced an error 14098, telling me “The component store has been corrupted”. Well, fine with me, this never gave me any trouble as far as I know…

    When after this failed cleanup I ran the component store analysis again, it turned out the “Actual Size of Component Store” had in fact grown slightly, from 6.96 GB before cleanup to 7.00 GB after cleanup! Well, maybe this kind of thing is why some people recommend doing a fresh system reinstall every few years?

    Whatever, this was a fascinating and enjoyable waste of time ;-)

    1. Steve said on March 15, 2016 at 9:33 am
      Reply

      Hank, try this – again from an elevated command prompt – to deal with component store corruption –

      DISM.exe /Online /Cleanup-Image /RestoreHealth

      This has probably been covered previously by Martin but I don’t have the URL. Whenever you run SFC (System File Scan “sfc.exe /scannow”) and it reports unfixable errors, this is the solution. In Windows 7 the RestoreHealth option wasn’t available, so this is one area where Windows 8.1 is superior to the older system.

      .

  10. Andy said on March 14, 2016 at 5:21 pm
    Reply

    I got error 6800

    1. Pete said on March 14, 2016 at 5:42 pm
      Reply

      Same here.

      for “dism.exe /Online /Cleanup-Image /StartComponentCleanup”

      “Error: 6800”
      “The function attempted to use a name that is reserved for use by another transaction”

      Windows 8.x is crap. I was much happier with WinXP which was solid as a rock. You could run it for many many months without reboot (only hibernate/sleep). Win8 starts bugging out after some weeks of same. And constantly different and new problems everywhere. Win8 is crap.

      I need to push myself to learn and move to linux fast.. if only I would have more time to do it; I would need to have a generic “crash course” (i.e. what’s good to know-kind of lesson) and a linux “security” related information upload to my brain. Martin? Any idea of doing linux crash course article (/set of articles)?

      1. Andy said on March 14, 2016 at 5:45 pm
        Reply

        Did a bit on the googler and found that this error is caused by antivirus software? I turned mine off and it completed with no errors

  11. ilev said on March 14, 2016 at 5:11 pm
    Reply

    Windows folder 24.6 GB, winsxs 13.1 GB.
    Win 7 sp1 64bit. Blocked Windows updates for the last 1.5 years.

    1. zouzi said on March 14, 2016 at 8:09 pm
      Reply

      Windows folder 17,2 GB, winsxs 9,71 GB.
      Win 7 SP1 x64, all critical updates but only manual.
      Winsxs clean with System Backup Cleaner from 360TS.

    2. Pants said on March 14, 2016 at 5:36 pm
      Reply

      Windows folder 20.1Gb , winsxs 9.4gb (using folder properties)
      Win7 Ultimate SP1 64bit – same as you, haven’t done any OS updates for about 18months, maybe 2 years. I used to do them manually every 3 to 6 months, but can’t be arsed anymore. Everything Windows/MS is locked down anyway (IE, bunch of services, office settings (eg trust centers/macros etc, and I don’t use outlook)). Pretty sure about 95% of the critical updates wouldn’t affect me. I spose I should really do a new disk image, do updates, re-patch Win10 blocks etc.

      1. Pants said on March 15, 2016 at 10:14 pm
        Reply

        @John Krazinski – you’re a clown. I’ll reply to you this one time (unless you actually ever post anything relevant worth discussion), just to let you know that you’re an absolute clown. Go ahead, waste your time posting silly replies and retorts, thinking you’re smart and witty. Everyone else can see you’re playing the fool and being an idiot. Without bothering to check, I’m pretty sure you’ve only ever used this name to post stupid comments in reply to mine. Keep doing it man, waste your time, trying to troll me – it ain’t gonna work.

        PS: say hi to JuJu for me

      2. John Krazinski said on March 15, 2016 at 2:47 pm
        Reply

        Nooooooooooooooooooooooooo! they will spy on you dude.
        The government man, the CIA. It is all a conspirancy man.
        I still use Windows 3.11. Windows 95 have too many security issues.
        I’m considering an upgrade next year to Windows 98.

  12. Tom Hawack said on March 14, 2016 at 4:32 pm
    Reply

    Is this a Win8+ component as well, but I don’t have “Servicing” in Task Scheduler (local) > Task Scheduler Library > Microsoft > Windows > Servicing > StartComponentCleanup …

    As for my WinSXS folder, TotalCommander reports 16GB (!) for 2 files and 19,604 folders.
    16GB seems a lot when at the same time my C:: disk reports 38GB of used space.
    Win7 here, looks like I won’t be able to cleanup that WinSXS folder.

    Running dism.exe /Online /Cleanup-Image /AnalyzeComponentStore leads to an Error11 stating (in French) that I cannot run a 32-bit version of DISM on a running 64-BIT OS, and invites me to use a DISM version corresponding to the architecture of my computer.

    So,
    1- Need a 64-BIT version of DISM
    2- Even with DISM 64-BIT (if available, surprised not to have it on Windows natively 64-BIT), ” the commands will only work on Windows 8 or newer machines.”.

    16GB (or less since reported by TotalCommander and considering the article’s info), without knowing if it’s being cleaned with the Task Scheduler or not, if it’s “cleanable”. That’ll make my afternoon!

  13. Ross Presser said on March 14, 2016 at 3:12 pm
    Reply

    unfortunately, /AnalyzeComponentStore does not go all the way back to Vista. I’m not sure when exactly it was introduced, but here’s what I see when I try this on Windows 2008 server:

    C:\Windows\system32> dism.exe /Online /Cleanup-Image /AnalyzeComponentStore

    Deployment Image Servicing and Management tool
    Version: 6.1.7600.16385

    Image Version: 6.1.7601.18489

    Error: 87

    The analyzecomponentstore option is not recognized in this context.
    For more information, refer to the help.

    The DISM log file can be found at C:\Windows\Logs\DISM\dism.log

    1. Martin Brinkmann said on March 14, 2016 at 3:35 pm
      Reply

      Thanks Ross, I have updated the article.

      1. Charles said on March 15, 2016 at 3:54 pm
        Reply

        Do you know if there is something like this I am able to run for a Windows 7?

    2. IDontWantAName said on March 14, 2016 at 3:19 pm
      Reply

      dism.exe /Online /Cleanup-Image /AnalyzeComponentStore/ /StartComponentCleanup were added in Win8 (6.2.9200)

      1. Martin Brinkmann said on March 14, 2016 at 3:33 pm
        Reply

        Thanks, I add the information to the article.

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.