Create More Space in Windows Drive

Create More Space in Windows Drive without extending the partition.

IF you have tried all your efforts (empty temp folders, cleaning user recycle bin etc…)¬† to create space in windows drive with no success, You may still have a scope to create space by compressing WinSXS folder resided in windows folder.

Follow steps mentioned as below to compress the size of winSXS, compression will not delete/move files to other location therefore no harm to compress winSXS folder.

Start a Command Prompt (cmd.exe) with run as Administrator privileges.

Step 1

Run below commands
Microsoft Windows Installer (msiserver) is an installation and configuration service, can install multiple patches with a single transaction that integrates installation progress, rollback, and reboots.

Trusted Installer (TrustedInstaller) is a service named Windows Modules Installer. It handles Windows updates and optional components.

We need to stop these two services and disable them to avoid interruption in compression process in case services start automatically, if these services are already stopped and in disable state then you only need to follow from Step 2 to Step 7

sc stop msiserver
sc stop TrustedInstaller
sc config msiserver start= disabled
sc config TrustedInstaller start= disabled

Step 2

Command to backup Access Control List (ACL) so it can be restore later on to its original condition.
icacls “%WINDIR%\WinSxS” /save “%WINDIR%\WinSxS.acl” /t

Step 3

Take ownership of WinSxS and subfolders
takeown /f “%WINDIR%\WinSxS” /r

Step 4

This command will Grant full rights on WinSxS to the current logged in user.
icacls “%WINDIR%\WinSxS” /grant “%USERDOMAIN%\%USERNAME%”:(F) /t

Step 5

Compress WinSxS files and sub-folders.
Compact /s:“%WINDIR%\WinSxS” /c /a /i *

Step 6

Restore ownership back to TrustedInstaller which you have taken in Step 3.
icacls “%WINDIR%\WinSxS” /setowner “NT SERVICE\TrustedInstaller” /t

Step 7

Restore Access Control List (ACL) which you have saved in Step 2.
icacls “%WINDIR%” /restore “%WINDIR%\WinSxS.acl”

Step 8
sc config msiserver start= demand
sc config TrustedInstaller start= demand
sc start msiserver
sc start TrustedInstaller

Open windows explorer to check space available in windows drive.

A powershell script is created to automate the same thing and is helpfull if you don’t want to run individual command or you are having bigger environment¬†Script to Compress WinSXS.

To know more about the commands used in this article click Icacls, Compact.