The short answer

To see the size that the WinSxS directory takes up:

Dism.exe /Online /Cleanup-Image /AnalyzeComponentStore

To clean up if necessary:

Dism.exe /online /Cleanup-Image /StartComponentCleanup

To do a really deep cleanup (you will no longer be able to roll back any previous updates):

Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase

Background

While helping someone clean up some disk space on their Windows desktop I decided it would be a good idea to collect the information about one of the more mysterious things together in one spot for easy access.

The Windows component store.

AKA the WinSxS directory

Getting a true picture of how much space this takes up is not straightforward as Windows uses hard links in the filesystem to avoid having duplicate files.

In modern Windows versions (since Vista) the component store is used to keep copies of critical Windows files this allows us, to quote Microsoft:

  • Using Windows Update to install new component versions. This keeps systems secure and up-to-date.

  • Enabling or disabling Windows features.

  • Adding roles or features using Server Manager.

  • Moving systems between different Windows Editions.

  • System recovery from corruption or boot failures

  • Uninstalling problematic updates

  • Running programs using side-by-side assemblies

So how do I see how much space this is taking and clean up if possible?

From a administrator prompt you can do the following

Dism.exe /Online /Cleanup-Image /AnalyzeComponentStore

Example from my local machine:

PS C:\Users\mgree> Dism.exe /Online /Cleanup-Image /AnalyzeComponentStore

Deployment Image Servicing and Management tool
Version: 10.0.22621.1

Image Version: 10.0.22621.382

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

Component Store (WinSxS) information:

Windows Explorer Reported Size of Component Store : 10.21 GB

Actual Size of Component Store : 9.81 GB

    Shared with Windows : 6.12 GB
    Backups and Disabled Features : 3.69 GB
    Cache and Temporary Data :  0 bytes

Date of Last Cleanup : 2022-08-12 23:31:18

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

The operation completed successfully.
PS C:\Users\mgree>

If needed from this point you can run the cleanup commands if needed.

Reference

Microsoft Determine the actual size of the winsxs folder

Microsoft Clean up the winsxs folder