preloader
17 June 2014 / #Winsxs

WinSxS on diet

Update 2014.08.28 : Adding Microsoft KB in order to be able to clean WSUS updates on 2008r2 sp1 in GUI, big thanks to ctxblog.fr Since the version NT6.0 of Windows kernel (i.e. since Windows Vista and Server 2008, you can have further details here), one of the most-asked question should have been Why my folder C:\Windows\WinSxs is so huge ?. This post is basically a memento given the number of time we asked ourselves this question (and it’ll free up our Evernote ^^).

Dwight_Schrute_Question

We will later list all possible commands depending on the version of Windows (which are improving through different versions), but first we thought some detailed explanation of what this famous folder is used for could be helpful.

Long story short, Side-by-side technology (aka ‘SxS’) is a standard for executable files since Windows ME version, that attempts to alleviate problems that arise from the use of dynamic-link libraries in Microsoft Windows. Such problems include version conflicts, missing DLLs, duplicate DLLs, and incorrect or missing registration. Side-by-side technology is conceptually the native equivalent of the .NET Global Assembly Cache. In side-by-side, Windows stores multiple versions of a DLL in the WinSXS subdirectory of the Windows directory, and loads them on demand (relying on hardlinks between system and WinSxS folders):

2014-04-09_10-40-36

Now, here are the tools at your disposal to help you manage better WinSxS folder. The first command that’s available is:

dism /online /cleanup-image /SPSuperseded

This command is useful only if a Service Pack have been installed. It will remove backup files created during service pack installation.

Windows 8 and Windows Server 2012 introduce a new feature called [Feature On Demand](http://technet.microsoft.com/en-us/library/jj127275.aspx). Now, you are able to remove installation files of unwanted roles and features of Windows. By default, Windows store in %windir%\WinSxS all source files for roles and features whether they’re installed or not, to allow media-less installation (as of C:\Windows\i386 back in time). If you do not need these roles/features (or if you want to size at best your OS), you can now delete unwanted installation files to free some GB (via PowerShell or DISM.exe):

Get-WindowsFeature | ?{$_.Installed -eq 0 -and $_.InstallState -eq 'Available'} | Uninstall-WindowsFeature -Remove
dism /online /disable-feature /featurename:TFTP /remove

There’s also a second command available that will purge obsolete component (superseded):

dism /online /cleanup-image /StartComponentCleanup

Since Windows 8.1 and Server 2012 R2, one last command is available that will improve the purge:

dism /online /cleanup-image /StartComponentCleanup /ResetBase

All these commands can take some time (a lot of time if you have a lot of updates) but at the end, it will allows you to shrink at best WinSxS folder size (who want some shiny clean template?).

Since Windows 2008 R2 SP1, you now have the ability to use cleanup tool (through GUI) to manage WinSxS folder as detailed in this article by installing the KB2852386, but that’s funless :p


> Frederic MARTIN