Analyze and clean the WinSXS folder


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 Gigabyte depending on the system it is analyzed on.

WinSXS, the full path is c:\Windows\WinSXS\, 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 Windowsx 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.
  2. Run the command dism.exe /Online /Cleanup-Image /AnalyzeComponentStore
Read also:  Windows 10 Creators Update Apps uninstallation information

The parameter /Online refers to the current installation, and /Cleanup-Image /AnaylzeComponentStore to analyzing 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.

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.

Categories