WinSxS, a folder called the Windows Component Store that is used during Windows updates, Service Packs, and hotfix installations. It’s located in c:\windows folder containing all the files required to finish these installations. It does grow over time as more updates, features, or roles are added to the installation. Microsoft recommends not touching this WinSxS folder for the purpose of gaining more disk space. But you can do so if you are running short on space by following the right direction.
We have a post that describes how to clean up WinSxS folder on a Windows 8 computer but unfortunately, the same step doesn’t seem to be working on a Windows Server 2008 R2 system. If you have a 2008 R2 server that runs short on the system drive, this post will definitely help you.
Before I took the same steps on one of my servers, I used a free folder analysis tool called TreeSize Free to check my system drive to see how many spaces are occupied by this WinSxS folder, a total of 14GB.
The proper way of doing things like this is to use a built-in tool called Disk Cleanup. Unfortunately, it’s not installed by default when you first installed Windows Server 2008 R2. So, the first step we need to do is to install Disk Cleanup utility which is part of a system feature called Desktop Experience.
Go to Control Panel → Turn Windows features on or off, and click Add Features in Feature Summary section. A wizard pops up.
Check Desktop Experience from the list, click Add Required Features if another window pops up, go to Next, and Install. It takes a few moments to finish. Once it’s done, restart your server to finish the installation process.
Next step, you will need to install a separate Windows Update that adds an additional option to delete outdated Windows updates. Go to this download page and download the update specifically for Windows Server 2008 R2. Then install it. It doesn’t require a reboot once it’s installed.
Now let’s get to the real cleaning process. Go to Start → All Programs → Accessories → System Tools, and launch Disk Cleanup.
Check both Service Pack and Windows Update Cleanup, as well as any other related to the upgrade. In my case, that’s going to free up almost 6GB of space from my system drive. Click OK to delete these selected files.
Now let’s run TreeSize free tool again and see how much space I gained from this process. Note that you may need to restart the server to see the difference.
That’s it. If you have quite a few Windows 2008 R2 servers, you can automate this process by using this PowerShell script.