Skip to content

Instantly share code, notes, and snippets.

@cocolacre
Created November 25, 2017 13:56
Show Gist options
  • Save cocolacre/b57cd805c64942ea649ebde192cf1a89 to your computer and use it in GitHub Desktop.
Save cocolacre/b57cd805c64942ea649ebde192cf1a89 to your computer and use it in GitHub Desktop.
:: SOURCE http://dandar3.blogspot.ru/2013/01/how-to-ntfs-compress-windows-winsxs.html
:: copypasted by vadik
:: before: 9.46 GB (10,168,741,888 bytes)
:: after: 7.20 GB (7,732,994,048 bytes)
:: RUN AS ADMIN
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 /c /s:"%WINDIR%\WinSxS" /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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment