Home > Uncategorized > Compress WinSxS

Compress WinSxS

This post is awesome. My Windows Seven virtual machine will finally fit on my usb key. I just copy the commands here for the record, and I group them so they can be easily copied to a .bat file.

REM Stop and disable Windows Installer and Windows Module Installer services
sc stop msiserver
sc stop TrustedInstaller

REM Backup ACLs for WinSxS folder (see icacls), so we can restore later
icacls "%WINDIR%\WinSxS" /save "%WINDIR%\WinSxS.acl" /t

REM Take ownership of WinSxS and subfolders
takeown /f "%WINDIR%\WinSxS" /r

REM Grant full rights on WinSxS to your user
icacls "%WINDIR%\WinSxS" /grant "%USERDOMAIN%\%USERNAME%":(F) /t

REM Compress WinSxS files and sub-folders
compact /s:"%WINDIR%\WinSxS" /c /a /i *

REM Restore ACLs for WinSxS folder we saved earlier.
icacls "%WINDIR%" /restore "%WINDIR%\WinSxS.acl"

REM Restore Windows Installer and Windows Module Installer services
sc config msiserver start= demand
sc config TrustedInstaller start= demand
Advertisements
Tags: ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: