Compress WinSxS Folder


The Windows component store (C:\Windows\winsxs) directory is used during servicing operations within Windows installations. Servicing operations include, but are not limited to, Windows Update, service pack, and hotfix installations.

The component store contains all the files that are required for a Windows installation. And, any updates to those files are also held within the component store as the updates are installed. This causes the component store to grow over time as more updates, features, or roles are added to the installation. The component store uses NTFS hard links between itself and other Windows directories to increase the robustness of the Windows platform.

Following commands will comperss the winsxs folder (not supportet by microsoft):

cd %WINDIR%\winsxs

sc stop msiserver
sc stop TrustedInstaller
sc config msiserver start= disabled
sc config TrustedInstaller start= disabled
icacls %windir%\WinSxS /save %windir%\WinSxS.acl /t
takeown /f %windir%\WinSxS /r
icacls %windir%\WinSxS /grant "%USERDOMAIN%\%USERNAME%":(F) /t
compact /s:%windir%\WinSxS /c /a /i *
icacls %windir%\WinSxS /setowner "NT SERVICE\TrustedInstaller" /t
icacls %windir% /restore %windir%\WinSxS.acl
sc config msiserver start= demand
sc config TrustedInstaller start= demand

REM reboot recommended
REM shutdown -r -t 0