Guest User

winsxs compress

a guest
Sep 22nd, 2014
213
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2. sc config msiserver start= disabled
  3. sc config TrustedInstaller start= disabled
  4. sc stop msiserver
  5. sc stop TrustedInstaller
  6.  
  7. setlocal enabledelayedexpansion
  8.  
  9. pushd %windir%\winsxs
  10. for /r %%f in (*) do (
  11.  
  12.     set attr=%%~af
  13.     set c=!attr:~5,1!
  14.  
  15.     if "!c!" == "-"  (
  16.         if %%~zf gtr 4096 (
  17.                 set multi=
  18.                 for /f "skip=1" %%p in ('fsutil hardlink list %%f') do set multi=1
  19.                 if not defined multi (
  20.                 echo %%f
  21.                     takeown /A /F "%%f"
  22.                     icacls "%%f" /grant *S-1-5-32-544:(F^)
  23.                     Compact /C /A /I "%%f" >> "%~dp0wsxscompact.log"
  24.                     icacls "%%f" /setowner *S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464 /L /C
  25.                 icacls "%%f" /reset
  26.                 )
  27.         )
  28.             rem else echo == %%f too small
  29.     )
  30.         rem else echo == %%f already compressed
  31. )
  32. popd
  33.  
  34. sc config TrustedInstaller start= demand
  35. sc config msiserver start= demand
  36. pause
RAW Paste Data