WinSXS folder is the component store of Windows vista and later operating systems. Windows OS stores all its core components within WinSXS directory.

WinSXS folder is the only place where OS components are stored; everything else is just hard links. To prove this, use the fsutil to check the hardlinks of a system file.

So, WinSXS starts large! But why is it growing larger?

The answer is updates 🚀

Every time a binary updates, a new version of the whole component is saved, and the old version is retained (for reliability) in the component store. The updated version of a component is projected to the system (hard linked) but the old version is simply retained without hard links.

It is for this reason that an update can be safely uninstalled from a system: in such a case, the next higher version is used. Also, other component changes may be triggered as a result of dependencies.

It is common to perceive WinSXS folder to be much larger than it actually is. Windows explorer (and dir command) do not distinguish between actual files and hard links. To gain a more accurate understanding of WinSXS storage consumption, use the SysInternal du utility (du -v c:windowswinSXS).

💣 Do not delete winSXS files manually

In such case it will break the OS!

Features on Demand

“Features on demand” introduced in Windows 8 and Windows Server 2012. Using features on demand, you can remove role and feature payloads from the OS to conserve disk space.

Windows OS stores all feature and role payloads (installed or not) under the %windir%/WinSXS folder, which makes it possible to add new features and roles without an installation media.

In Windows Server, you can remove those payloads by using the PowerShell command uninstall-windowsfeature with the -remove switch.

In case you want later to install a feature which you previously removed – you can use the install-windowsfeature command.

Install-windowsfeature will try to install a windows feature from the following sources:

  • Local winSXS store
  • Windows Update in case of a payload removal from the local WinSXS store
  • A custom source in case you add the -source switch. This is useful when you have a local repository, or a Windows Server USB/DVD image.

To cleanup all windows feature payloads you currently don’t use, execute the following command:

Copy to Clipboard

The first part of the command gets the windows features that are not currently installed but have their payloads stored in the system. The second part removes these files from winSXS store.

In case of Windows (desktop version) the powershell cmdlet won’t work; thus it is required to use dism.exe command, which can also be used in Windows Server.

To get features installation status in Microsoft Windows:

Copy to Clipboard

To get a feature state status:

Copy to Clipboard

To remove a feature:

Copy to Clipboard

WinSXS cleanup – superseded components

In order to perform a WinSXS cleanup, you can remove any backup files created during the installation of a service pack by using the following command:

Copy to Clipboard

Note, that after you execute that command, you won’t be able to uninstall a service pack.

You can further perform a WinSXS cleanup by removing any superseded components:

Copy to Clipboard

Note, that the /ResetBase switch can only be used in Windows 2012R2+ and Windows 8.1+ in order to reset the base of superseded components and optimize the WinSXS cleanup process.