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.

LABOPS-0078

 

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

LABOPS-0079

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

LABOPS-0081

LABOPS-0083

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

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

LABOPS-0084

Also lets take a look on WinSxS folder size:

LABOPS-0086

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s