Skip to main content

How to Clean Up and Compress WinSxS Folder in Windows 8

How to Clean Up and Compress WinSxS Folder in Windows 8

In this article we will talk about the WinSxS folder in Windows 8, the reasons of its constant growth and means of cleaning. The directory C:\windows\WinSxS is the storage of Windows components. This directory contains DLLs, binary and XML files necessary for installation and operation of any of Windows roles. When installing the OS updates, the new version of the updated component is installed in the system, while the old one is stored in the WinSxS storage (according to Microsoft, it is necessary to provide compatibility and make it possible to roll back to the old versions of components).

Contetn of WinSxS folder in windows 8
Another feature of the WinSxS folder is a huge amount of hard links in it. A hard link is a peer file pointer. That means that a pointer and a source file can have different names and are located in different directories of the same volume, but they point to the same object. It is due to hard links, taken into consideration when calculating the total size of the folder, that the file managers (including Windows Explorer) show a bit exaggerated size of the WinSxS folder. You can find out the real size of the WinSxS folder using du (small utility from Sysinternals):
 du -v c:\windows\winSXS
get winsxs folder real size with DU
Many users commonly ask if they can delete files from the WinSxS folder manually. The answer is categorically NO! These actions are likely to result in injuring the Windows 8 health. Though some attempts to remove files from the WinSxS folder can be successful, this means cannot be recommended due to its potential danger to the system.
Let’s dwell on the less harmful means of cleaning up the WinSxS folder in Windows 8. These are:
To reach the best result, you can use all three ways simultaneously.

Disk Cleanup Tool

Disk Cleanup Tool (cleanmgr) - which allows to delete deprecated updates (updates which were replaced with the newer ones).
 Tip.  This functionality is also available in Windows 7. Click here for details.

Features on Demand in Windows 8

In the article «Safe Clean Up of the WinSxS Folder in Windows Server 2012» we considered the new option Features on Demand, that allowed to remove binary files of the unused roles from the WinSxS folder. To remove the unused roles from the disk, there is a special PowerShell cmdlet – Uninstall-WindowsFeature. However, it’s not all as easy as it sounds in Windows 8. The thing is that there is no Uninstall-WindowsFeature cmdlet in Windows 8.  Features on Demand technology is based either on DISM or DISM PowerShell cmdlet. Moreover, it’s important to know that DISM command in contrast to Uninstall-WindowsFeature cmdlet doesn’t analyse package dependencies. So, after removing a Windows package using DISM only the component specified in the command will be removed and all dependent packages will stay in the system. This is the reason why DISM shouldn’t be used to remove roles from the disk in Windows Server 2012, since there is a more convenient and functional way to do it.
You can get the complete list of available functions in Windows 8 with the command:
DISM.exe /Online /English /Get-Features /Format:Table
get windows 8 feature list
Let’s suppose, for instance, that we won’t need TelnetServer role. Let’s delete it from the disk (from the WinSxS directory) completely using the command:
DISM.exe /Online /Disable-Feature /Featurename:TelnetServer /Remove
how to delete telnetserver feature in windows 8
If you display the list of all functions available in Windows 8, you can see that the component status has changed to Disabled with Payload Removed.
Thus, Windows 8 allows to significantly reduce the size of the WinSxS folder by removing the unused components from the disk. The only thing is that this cleanup method suits only advanced users, who know what this or that component does in Windows 8.

Compressing the Contents of the WinSxS Folder in Windows 8

Another way to reduce the size of the WinSxS directory in Windows 8 is to compress the directory contents on the level of the NTFS file system.
  NoteAs in case of any nonstandard intervention into the system configuration, you are strongly recommended to perform a full system backup.
    1. Open the command prompt as administrator
    2. Stop and disable Windows Installer and Windows Module Installer
      sc stop msiserver
      sc stop TrustedInstaller
      sc config msiserver start= disabled
      sc config TrustedInstaller start= disabled
    3. Let’s back up the access lists (ACLs) assigned to the files and folders in the WinSxS directory (this backup will become necessary when recovering original ACLs)
      icacls "%WINDIR%\WinSxS" /save "%WINDIR%\WinSxS_NTFS.acl" /t
      icacls - backup winsxs ACL
    4. Assign yourself as an owner of the WinSxS folder and all its subfolders
      takeown /f "%WINDIR%\WinSxS" /r
    5. Grant your account full rights on the WinSxS directory
      icacls "%WINDIR%\WinSxS" /grant "%USERDOMAIN%\%USERNAME%":(F) /t
    6. Compress the WinSxS directory and its contents with the command compact. Some files can be used by the system, so if you run this command without /i, the compression will stop at the first file currently used by the system. You can find the name of the process that has opened this file (CTRL+F) and stop it with Process Explorer. Thus you can achieve maximum compression ratio. We will confine ourselves to the compression of the unused files.
      compact /s:"%WINDIR%\WinSxS" /c /a /i *
      compress winsxs folder with compact utility
    7. Change the WinSxS directory owner back to TrustedInstaller
      icacls "%WINDIR%\WinSxS" /setowner "NT SERVICE\TrustedInstaller" /t
    8. Recover original ACLs to the WinSxS directory
      icacls "%WINDIR%" /restore "%WINDIR%\WinSxS_NTFS.acl"
      winsxs ntfs compress complited
    9. Recover the startup of Windows Installer and Windows Module Installer
      sc config msiserver start= demand
      sc config TrustedInstaller start= demand
Now check the size of the WinSxS folder:
size of winsxs folder
As you can see, in our example after the compression the size of the WinSxS folder has reduced from5.8GB to 4GB (approximately by 1/3). Not bad, especially taking into consideration that the compression took place for a small SSD with free space highly appreciated.

What Can WinSxS Reduction Influence on?

Windows 8 works with compressed files in the transparent mode. However, it can take some extra time to compress/decompress it, which means that the component or update installation processes can become somewhat slow. But the modern CPU performs these processes almost instantaneously, so a user can see no difference in speed. On top of that, if a hard drive is slow and a CPU is fast enough, you can observe even the increase in the speed of operation! We should note that when the whole contents of the WinSxS folder is compressed, a number of files in some other system directories will also turn to be compressed due to the hard links.
These commands can either be run separately (then it is much easier to control the results of each of them) or used in a single script file. If you run it, the described compression procedure of the WinSxS folder will start. You can download the ready-to-use command file here: winsxs_ntfs_compress.bat
This script can be used regularly during system operation, because after new updates or applications have been installed, new uncompressed files will appear in the WinSxS folder.
  NotesYou can find in the web another script that allows to reduce the size of the WinSxS folder— WinSxSLite (by Christian Bering Boegh). According to the developer, this script searches the latest library files on the disk, makes links to them from all previous versions and deletes old versions. We do not recommend our readers to use WinSxSLite, because in spite of the idea being good, the result of running the script is unpredictable and though the WinSxS folder is reduced, some Windows 8 functionality becomes unavailable.

Popular posts from this blog

Hidden Wiki

Welcome to The Hidden WikiNew hidden wiki url 2015 http://zqktlwi4fecvo6ri.onion Add it to bookmarks and spread it!!!
Editor's picks Bored? Pick a random page from the article index and replace one of these slots with it.
The Matrix - Very nice to read. How to Exit the Matrix - Learn how to Protect yourself and your rights, online and off. Verifying PGP signatures - A short and simple how-to guide. In Praise Of Hawala - Anonymous informal value transfer system. Volunteer Here are five different things that you can help us out with.
Plunder other hidden service lists for links and place them here! File the SnapBBSIndex links wherever they go. Set external links to HTTPS where available, good certificate, and same content. Care to start recording onionland's history? Check out Onionland's Museum Perform Dead Services Duties. Introduction - Clearnet search engine for Tor Hidden Services (allows you to add new sites to its database). DuckDuckGo - A Hidden S…


Good News [May 08, 2015]: IDM developers got smarter, but the crackers are always a step ahead. Follow this article and send an email to if you are desperate. I can NOT post any crack here for legal reasons. Happy Downloading with IDM. ;) *********** first tip is to use latest crack for idm from idm universal web crack and make sure u are using all latest vers I am sure many of us are too much dependent on Internet Download Manager a.k.a. IDM. The main reason didn’t permanently switch to linux was IDM. I mainly use it for batch downloading and download streaming videos. Till yesterday, IDM was working fine with me (of course with fake serial numbers, keygen, crack, patch etc. which could be found with little effort). But few days ago, with the latest update version 6.18 build 7 (released on Nov 09, 2013) Internet Download Manager was literally had a breakthrough and crushed all the serial numbers, …

Mouse, touchpad, and keyboard problems in Windows

Mouse, touchpad, and keyboard problems in Windows Introduction This tutorial is designed to help you identify and fix common mouse, touchpad, and keyboard problems in Windows. It doesn't cover device problems related to specific programs. Mouse, touchpad, and keyboard problems can have a number of causes: Cables that aren't connected properly Incorrect device settings Missing updates Corrupted or incompatible drivers Hardware problems Check hardware Many mouse, touchpad, and keyboard problems are caused by hardware that isn't set up properly. Here's some information about how to check your device, make sure cables are connected properly, make sure the hardware has power, and check the settings. Make sure cables are connected properly Check that all cables are plugged in to the correct locations. This can include mouse and keyboard, PS2 and USB cables, and, in some cases, external USB touchpad cables. Disconnect USB cables and wait for a short time for the device drive…