WinSXS Folder

The WinSXS folder contains all Windows system components. When Windows installs updates, it drops the new Windows component in the WinSXS folder and keeps the old component in the WinSXS folder. This means that every Windows Update you install increases the size of your WinSXS folder. This allows you to uninstall operating system updates when necessary.
The WinSXS folder at C:\Windows\WinSXS is massive and continues to grow the longer you have Windows installed. This folder builds up unnecessary files over time, such as old versions of system components.
To Reduce the Size of the WinSXS Folder You may refer to the following steps to remove the file under the %windir%\winsxs\ManifestCache\ to release some disk space that the WinSXS folder takes.

1. Run the following commands from an elevated command prompt (Run cmd as admin):
2. Run “Compcln.exe”
3. Net stop trustedinstaller
4. Wait for it to stop and ensure it stops successfully. If you are unable to stop the service, you may need to
restart your machine.
5. Takeown /f %windir%\winsxs\ManifestCache\*
6. Icacls %windir%\winsxs\ManifestCache\* /GRANT administrators:F
7. Del /q %windir%\winsxs\ManifestCache\*
• There are different tools to do this for different Operating systems
• Windows Vista or Windows Server 2008 Service Pack 1: VSP1CLN.EXE
• Windows Vista or Windows Server 2008 Service Pack 2: Compcln.exe
• Windows 7 or Windows Server 2008 R2 Service Pack 1: DISM /online /Cleanup-Image /SpSuperseded or Disk
Cleanup Wizard (cleanmgr.exe)

Please see the folowing PowerShell script that perform these tasks and reduce the WinSXS folder size. The script has been tested on windows2008 servers.


###########################################################################
#
# AUTHOR: Guy Naftaly
#
# NAME: reduce-winsxs
#
# COMMENT: the script delete WinSXS ManifestCache Folder
#
# VERSION HISTORY: 1.0 23/01/2014 - Initial release
#
###########################################################################

$server = ‘server_name’

#Run “Compcln.exe”#

COMPCLN.EXE /quiet

#stop trustedinstaller service on $server#

Get-Service -Name trustedinstaller -ComputerName $server | Stop-Service -Verbose
Get-Service -Name trustedinstaller -ComputerName $server -Verbose

#Delete WinSXS ManifestCache Folder#

Takeown /f C:\Windows\winsxs\ManifestCache\*
Icacls %windir%\winsxs\ManifestCache\* /GRANT administrators:F
Remove-Item C:\Windows\winsxs\ManifestCache\*

#End#

2 thoughts on “WinSXS Folder”

Leave a comment