How to analyze and clean the WinSxS folder with DISM

To analyze the WinSxS folder, open Command Prompt as administrator and run Dism.exe /Online /Cleanup-Image /AnalyzeComponentStore. DISM reports the size File Explorer shows, the actual size of the component store, how much of it is shared with Windows, how much is reclaimable overhead, the date of the last cleanup and whether a cleanup is recommended. If it says Yes, run Dism.exe /Online /Cleanup-Image /StartComponentCleanup.
This guide explains why File Explorer overstates the size of C:\Windows\WinSxS, how to read every line of the DISM report, and which of the built-in cleanup methods to pick, including the one that removes the ability to uninstall updates.
What the WinSxS folder is and why it looks so big
The WinSxS folder (C:\Windows\WinSxS) is the Windows component store: it holds the files Windows needs for servicing, such as installing updates, enabling optional features and rolling back a faulty update. Because it keeps older component versions as backups, it grows over time on every system. We covered the background in our WinSxS folder explainer.
The folder looks much bigger than it is because of hard links. Many files in WinSxS also appear in other places, for example C:\Windows\System32, but there is usually only one physical copy on the disk. File Explorer and disk analyzers such as WizTree count each hard-linked file at full size, so they report the shared files as if they lived in WinSxS. That is why the real overhead is usually far smaller than the size Explorer shows, as Microsoft's own example in the report section below illustrates.
Microsoft warns not to delete the WinSxS folder or files inside it. Some system files exist only there, and removing them can leave a PC unable to boot or to install updates. Use DISM or the other built-in tools below instead.
How to run DISM /AnalyzeComponentStore
DISM /AnalyzeComponentStore measures the real size of the component store and tells you whether a cleanup is worth running. Microsoft's current documentation covers Windows 10 and Windows 11.
- Press the Windows key, type cmd, right-click Command Prompt and select Run as administrator. Windows Terminal (Admin) or PowerShell (Admin) work as well.
- Type Dism.exe /Online /Cleanup-Image /AnalyzeComponentStore and press Enter.
- Wait for the scan to reach 100 percent. It can take a few minutes.
- Read the report (explained in the next section) and note the Component Store Cleanup Recommended line.
The parameter /Online targets the running Windows installation, and /Cleanup-Image /AnalyzeComponentStore tells DISM to analyze that installation's component store. Typing dism.exe /Online /Cleanup-Image /? lists all related options. The command only reads data, so it is safe to run at any time.

Run the analysis again after any cleanup to see how much space was freed.
How to read the AnalyzeComponentStore report
The AnalyzeComponentStore report splits the component store into shared files and overhead, and only the overhead can be reduced. Microsoft defines the lines as follows:
| Report line | What it means | Can cleanup reduce it? |
|---|---|---|
| Windows Explorer Reported Size of Component Store | The size File Explorer calculates, which ignores hard links and overstates disk use | Not a real figure |
| Actual Size of Component Store | The size after accounting for hard links, including files shared with Windows | Partly |
| Shared with Windows | Hard-linked files Windows needs to run; not overhead | No |
| Backups and Disabled Features | Older component versions kept for rollback, plus features you can enable later | Yes |
| Cache and Temporary Data | Files the component store uses internally to speed up servicing | Yes |
| Date of Last Cleanup | When the last component cleanup finished | Informational |
| Number of Reclaimable Packages | Superseded packages that cleanup can remove | Yes |
| Component Store Cleanup Recommended | Whether a cleanup would likely shrink the overhead | Your decision signal |
To get the true overhead, add Backups and Disabled Features to Cache and Temporary Data. In Microsoft's own example, Explorer reports 4.98 GB, but the overhead is only about 507 MB (506.90 MB of backups plus 279.52 KB of cache). That sum is the most a cleanup can win back, so a large Explorer figure alone is no reason to clean.
How to clean up the WinSxS folder
The safest way to clean up WinSxS is to let DISM remove superseded components with /StartComponentCleanup. Windows offers several built-in methods, and they differ in how much they remove and what you give up:
| Method | What it does | Trade-off |
|---|---|---|
| StartComponentCleanup scheduled task | Runs automatically when the PC is idle and removes previous component versions at least 30 days after an update | 1-hour timeout; may not clean everything |
| Dism.exe /Online /Cleanup-Image /StartComponentCleanup | Removes previous versions of updated components immediately | No 30-day grace period for rollback |
| Same command plus /ResetBase | Removes all superseded versions of every component | Installed updates can no longer be uninstalled |
| Disk Cleanup, Clean up system files | Includes an option that cleans up Windows updates and shrinks the store | Graphical, less control |
To run the standard cleanup:
- Open Command Prompt as administrator.
- Run Dism.exe /Online /Cleanup-Image /StartComponentCleanup and wait for it to finish.
- Run /AnalyzeComponentStore again and compare the overhead.
Use /ResetBase only on a system that has run stable for a while after its last update, because it removes the option to roll back the updates installed so far (future updates can still be uninstalled). The /SPSuperseded option targets service pack backups and matters only on old installations.
How to check the automatic WinSxS cleanup task
Windows cleans the component store on its own with the StartComponentCleanup task in Task Scheduler, so most PCs never need a manual cleanup.
- Press the Windows key, type Task Scheduler and press Enter.
- Go to Task Scheduler Library > Microsoft > Windows > Servicing > StartComponentCleanup.
- Check the Last Run Time and Last Run Result columns.
- To trigger it manually, select the task and click Run under Selected Item, or run schtasks.exe /Run /TN "\Microsoft\Windows\Servicing\StartComponentCleanup" from an elevated prompt.
If the task runs regularly and DISM reports Component Store Cleanup Recommended: No, the folder is already as small as Windows intends it to be. For more free space, look elsewhere: Settings > System > Storage > Cleanup recommendations covers temporary files, large or unused files and unused apps, which helps free more space. A tool such as WizTree shows which files use the most space outside WinSxS.
FAQ
Is it safe to delete files from WinSxS manually?
No. Microsoft warns that deleting files from WinSxS, or the whole folder, can stop Windows from booting and break updates. Use DISM, the scheduled task or Disk Cleanup instead.
Can I delete the WinSxS ManifestCache folder?
ManifestCache is a subfolder of WinSxS, so the same rule applies: do not delete it by hand. Let DISM and the servicing tasks manage the store's cache and temporary data.
Why does the WinSxS folder not shrink much after cleanup?
Most of its reported size is files shared with Windows through hard links, which no cleanup removes. Only the Backups and Disabled Features and Cache and Temporary Data lines can go down.
Does StartComponentCleanup remove anything I need?
It removes previous versions of updated components, which means you lose the ability to roll back to them. Current Windows files and features stay intact.
Related: export Windows drivers with DISM, manage System Restore storage from the command line
@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?
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
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.
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.
Fred here is the English link: https://support.microsoft.com/en-us/kb/2852386
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.
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/
Martin, try the ResetBase parameter for DISM to free up even more disk space.
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.
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.
win7 folder with all updates excluding telemetry and stuff: 31.8gb
How do we do this on Windows 7 x64 for the WinSXS folder?
Had the same problem on Win7.
Fortunaltely I found
Dism++
Freeware
http://www.microsoftpro.nl/2011/07/28/how-to-cleanup-the-winsxs-folder-on-windows-7-sp1-windows-2008-windows-2008-r2-sp1/
Thanks Corky.
@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.
@Moloch, that only cleans up service pack backup files.
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?
Same question here…got the “Error: 87” reported above.
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.
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.
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 ;-)
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.
.
I got error 6800
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)?
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
Windows folder 24.6 GB, winsxs 13.1 GB.
Win 7 sp1 64bit. Blocked Windows updates for the last 1.5 years.
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.
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.
@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
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.
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!
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
Thanks Ross, I have updated the article.
Do you know if there is something like this I am able to run for a Windows 7?
dism.exe /Online /Cleanup-Image /AnalyzeComponentStore/ /StartComponentCleanup were added in Win8 (6.2.9200)
Thanks, I add the information to the article.