Cleanup WinSXS folder in Server 2012 R2

LABOPS-0082The 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.

In Windows Server 2012, A new feature called “Features on Demand” introduced. Instead of 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.

You can specify the source files location in case you want to install removed windows features.



Here in the screenshot, the folder size is 7.19GB.



Open PowerShell, and run the command Get-WindowsFeature to list all the features with their “Install State”.


The command to uninstall windows feature is:

Uninstall-WindowsFeature -Name “featurename” -Remove

With this command we can remove windows features one by one. Since we have list of features that can be uninstalled we can combine few commands as:

Get-WindowsFeature | Where-Object -FilterScript {$_.Installed -Eq $FALSE} | Uninstall-WindowsFeature -Remove



Now run the following command to verify the uninstallation of windows features

Get-WindowsFeature | WhereObject -FilterScript {$_.Installed -Eq $FALSE}


Also lets take a look on WinSxS folder size:



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s