The WinSxS folder, also known as the Component Store, contains system repositories and is a crucial part of the Windows environment. With time, this folder keeps growing without any limit and can take up a heap of unnecessary space on your hard drive.
This article discusses how you can save up that space without affecting the critical system files by safely deleting the unwanted files within the WinSxS folder.
What is the WinSxS folder
The WinSxS folder contains files such as DLLs, binaries, and other XML files that are used by the device. It also contains the information and files required to install Windows features. Each time your Windows gets an update, it is installed on your computer while the old ones are shifted to the WinSxS folder. This is also important to prevent the system from crashing by providing compatibility or to revert to old files in case of a system restore.
This is why the WinSxS folder keeps increasing in size over time. This folder can be found on the following path:
As you may find, the folder has a list of sub-folders and files that are used by the system.
How to check the size of the WinSxS folder
You can check the size of the folder through its properties in File Explorer. However, that is the actual size of the folder and not the one you can make available, since everything in the folder cannot be deleted to make space.
Along with cache, temporary files, backup and restore data, other critical files are also present. The properties bar does not indicate each individual category of the files within the WinSxS folder.
To check the size of each component storage within this folder, perform the following:
- Open Command Prompt as an Administrator.
- Enter the following command:
Dism.exe /Online /Cleanup-Image /AnalyzeComponentStore
- Now let the system scan the WinSxS folder and it will then display a list of the components and their sizes on the command-line interface.
You now have complete information on what WinSxS contains and what the size of each component is. We can now use this information to free up 1.14 GB (Backups and Disabled features) of unnecessary files and folders within WinSxS.
How to clean up WinSxS folder using Disk Cleanup
The Disk Cleanup tool is built into Windows 10 which can be used to perform safe operations to remove unnecessary system files. No critical system files are affected by using this utility, as opposed to deleting the WinSxS sub-folders manually using File Explorer, which poses a significant threat to Windows functionality.
Follow the guide below to perform this operation:
- Search for Disk Cleanup in the Start Menu and run it. (Note: Do not run as an Administrator)
- On the Drive Selection popup, select C: from the drop-down menu and click Ok.
- On the next screen, click on Clean up system files.
- The Drive Selection window will pop up again. Select C: again and click Ok.
- Now select the files you wish the tool to clean by checking the boxes next to them, and then click Ok.
- On the confirmation dialog box, click Delete files. The operation will then begin and safely remove all unnecessary files.
Although some of the unwanted files have been removed from the WinSxS folder, there is still a possibility to increase the available space even further. If required, move onto the next step.
How to clean up the WinSxS folder by removing Optional Features
Since the WinSxS folder also contains repositories for the optional features, you can create more space by removing the ones that are disabled, and you think you would not need it.
Perform the following to remove one feature at a time.
- Open Command Prompt as an Administrator.
- To find out the names and statuses of the current Optional Features in Windows 10, enter the following command:
DISM.exe /Online /English /Get-Features /Format:Table
- Now scan through the list and note the ones you think you do not need, and then enter the following command:
DISM.exe /Online /Disable-Feature /Featurename:TFTP /Remove
You may replace TFTP with a choice of your selected feature to delete it.
- Repeat the last step to remove all the repositories from the system relating to the Optional Features.
If you check the Optional Feature status again by running the same command, you will see that the Status has changed from Disabled to Disabled with payload removed.
How to compress the WinSxS folder to save space
The WinSxS folder can also be compressed, if not deleted. The compression of the folder would save a significant amount of space while having everything available. This method would not involve removing or deleting anything. However, a con of the compression method would be that the system would perform an additional step or compression and decompression each time it needs to access the folder.
This would also affect the time it takes to perform these functions. Nonetheless, the time difference is not much as Windows 10 performs these functions quite fast.
The process involves starting and stopping some services, as well as changing the ownership of certain files and folders. Therefore it is recommended to create a system restore point before proceeding any further.
- Launch the Command Prompt as an Administrator.
- Enter the following commands one after the other to stop the associated services and disable them from automatically rebooting:
sc stop msiserver
sc config msiserver start= disabled
sc stop TrustedInstaller
sc config TrustedInstaller start= disabled
- Now we must back up the Access Control Lists (ACLs) of all the files and folders. Enter the following command:
icacls "%WINDIR%\WinSxS" /save "%WINDIR%\WinSxS_NTFS.acl" /t
This will generate a text file with plain text, which will later be used to restore the default ACLs. This step might take a few seconds as there are a number of files to scan.
- Now assign the current user as the owner of WinSxS:
takeown /f "%WINDIR%\WinSxS" /r
This will assign ownership recursively, meaning that all sub-folders and files will also be affected.
- Now assign the current user full control of the WinSxS folder with the following command:
icacls “%WINDIR%\WinSxS” /grant “%USERDOMAIN%\%USERNAME%”:(F) /t
- Now enter the following command to compress all files and folders within WinSxS. Note that this will only compress the ones that are not in use by any other programs or processes:
compact /s:”%WINDIR%\WinSxS” /c /a /i *
This might take a few minutes to compress each file.
- Once the compression has been completed, we must now return ownership and permission to default. Enter the following commands one by one:
icacls "%WINDIR%\WinSxS" /setowner "NT SERVICE\TrustedInstaller" /t
icacls "%WINDIR%" /restore "%WINDIR%\WinSxS_NTFS.acl"
- Enter the following commands to restart the services we had earlier shut down:
sc config msiserver start= demand
sc config TrustedInstaller start= demand
You may now check the size of the WinSxS folder and notice that it has shrunk significantly, by almost a third.
The WinSxS file might be one of the most important ones in the system, but it’s also the biggest one, with an appetite for more storage space. However, no matter the amount of volume you allow for the system drive, it will become insufficient at one point.
Compressing or deleting the unnecessary files and folders can aid a great deal to the available storage, especially when it can be performed safely, without harming the Windows environment.