How to Clean Up the Component Store (WinSxS folder)

The Component Store or the WinSxS folder, located under the Windows folder, is used to support the functions needed to customize and update Windows.

winsxs folder contents

Whenever a new update or a FOD package is installed, it adds hundreds or thousands of files into the component store. The superseded components will be removed automatically by Windows at least 30 days after an update has been installed. To accomplish the task, Windows runs the built-in “StartComponentCleanup” task via Task Scheduler.

In Task Scheduler, the “StartComponentCleanup” task is located here:

Task Scheduler Library\Microsoft\Windows\Servicing\StartComponentCleanup

It’s run as part of Automatic maintenance, which means the job is run only when the system is idle.

Manually cleaning up the component store is usually unnecessary unless your OS partition is acutely short of disk space where every GB counts.

Cleanup the Component Store (WinSxS folder)

To clean up the component store, open an admin Command Prompt and run the following:

schtasks.exe /Run /TN "\Microsoft\Windows\Servicing\StartComponentCleanup"

-or-

Dism.exe /online /Cleanup-Image /StartComponentCleanup

-or-

Launch Disk Cleanup (cleanmgr.exe), select the “Windows Update Cleanup” option and click OK.

Note: The Disk Cleanup method can take additional time to complete because it does more than cleaning up the supserseded items. Please see the explanation below.

Difference between the three methods

1) The “StartComponentCleanup” task, when launched manually, the task will have a 1-hour timeout and may not completely clean up all files. So it may need to be run twice if you have many superseded components on the device. Also, the 30-day grace period doesn’t apply when manually launching this task.

2) The DISM command-line doesn’t have the 1-hour timeout limitation or the 30-day grace period.

3) The Disk Cleanup’s “Windows Update Cleanup” handler does two things. First, it does the equivalent of Dism /Online /Cleanup-Image /StartComponentCleanup. Secondly, it compresses the operating system files (if required) that aren’t already compressed.

For more information about the “Windows Update Cleanup” Disk Cleanup handler, please see the blog post of the Senior Microsoft employee Raymond Chen here → Why does the Disk Cleanup tool’s Windows Update Cleanup take so long and consume so much CPU? – The Old New Thing.

Additional Information

Optionally, to know the size of your component store and how much space can be reclaimed, run the following command before running the component cleanup.

Dism.exe /Online /Cleanup-Image /AnalyzeComponentStore

The output shows the size of the component store and tells you if cleanup is recommended. For example, this command outputs details that look like the below:

dism analyzecomponentstore



It says the following:

Dism /online /cleanup-image /analyzecomponentstore

Deployment Image Servicing and Management tool
Version: 10.0.XXXX.0

Image Version: 10.0.XXXX.0

[==========================100.0%==========================]

Component Store (WinSxS) information:

Windows Explorer Reported Size of Component Store : 6.35 GB

Actual Size of Component Store : 6.00 GB

    Shared with Windows : 3.11 GB
    Backups and Disabled Features : 2.88 GB
    Cache and Temporary Data : 1.54 MB

Date of Last Cleanup : 2023-03-15 11:04:21

Number of Reclaimable Packages : 2
Component Store Cleanup Recommended : Yes

The operation completed successfully.

The output is explained in the Microsoft article Determine the Actual Size of the WinSxS Folder.

It says that a component store cleanup is recommended. So, let’s run the command to cleanup the component store:

Dism.exe /online /Cleanup-Image /StartComponentCleanup

dism startcomponentcleanup

To finally check how much disk space has been reclaimed, rerun the following command:

Dism.exe /Online /Cleanup-Image /AnalyzeComponentStore

dism analyzecomponentstore

You can see from the screenshots that 1.43 GB of disk space has been reclaimed.

Editor’s note

The “/analyzecomponentstore” command-line is not a prerequisite for running “/StartComponentCleanup“. Run only “/StartComponentCleanup” (if required) instead of both commands, to save your CPU resources and prevent unnecessary disk I/O.

As said earlier, these commands need not be run manually, as the Operating System runs the WinSxS cleanup anyway.

To cleanup the WinSxS folder even more, the /ResetBase command-line can be used with the above DISM command. The command removes all the superseded components; you won’t be able to install a recent update which can be a drawback in some cases. Use the /ResetBase parameter only if the system is stable.

For more information, see the Microsoft article Clean Up the WinSxS Folder | Microsoft Learn.


One small request: If you liked this post, please share this?

One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
  • Pin it!
  • Share it to your favorite blog + Facebook, Reddit
  • Tweet it!
So thank you so much for your support. It won't take more than 10 seconds of your time. The share buttons are right below. :)

Ramesh Srinivasan is passionate about Microsoft technologies and he has been a consecutive ten-time recipient of the Microsoft Most Valuable Professional award in the Windows Shell/Desktop Experience category, from 2003 to 2012. He loves to troubleshoot and write about Windows. Ramesh founded Winhelponline.com in 2005.

Leave a Comment