In this post we’ll look at how to use PowerShell to reduce the size of the WinSxS folder in Windows Server 2012 R2.
A customer has a very quick SSD based server at a cloud provider, but although it is SSD based it only has a tiny 40GB C:, which is a very small footprint for the OS, a couple of apps and logs files. So i was asked to take a look and see what i could do to make a bit of room.
The WinSxS folder contains the files for all the Windows Features you can install in the default operating system. Each time you run a windows update files in the WinSxS folder get update and the size will continue to grow.
Since Windows Server 2012 Microsoft have made it very easy to tidy the WinSxS folder up. They introduced a new feature called “Features on Demand”. Rather than the WinSxS containing all the binaries for all the features you could possibly install on the server, “Features on Demand” allows you to remove the files for features you aren’t using.
If at a later date you want to install a feature you have removed from the WinSxS folder you’ll need to specify a location for the source files.
On some early installations of SBS 2011 OEMs weren’t always very generous with the hard disk partition size for C:, and administrators quickly found themsleves juggling for diskpace. Luckily there are wizards to move various componets of SBS (Exchange, WSUS, Sharepoint and Home Folders) to different locations, namely a different partion or data drive, but even by doing that an installation that has now been running for several years may find diskspace running out.
Last month Microsoft released an optional update for Windows 2008 R2 which added the ability to cleanup the WinSxS folder by using the Disk Cleanup Wizard. The WinSxS folder can often be numerous Gigabytes in size because it contains a copy of all the Windows Updates applied to the computer, effectively a complete copy if Windows so that you are able to roll back an update if you need to.
The only caveat to this process is that on the Windows 2008 R2 server you need to install the Desktop Experience Feature to be able to run the Disk Cleanup Wizard.