Remove all Uninstalled Feature Binaries

I’m still getting my head around this whole blog thing, but I’m going to write a quick article about trimming down a Windows Server 2012 install while I wait for my partner to recover from a small bout of vertigo.

The “Features on Demand” feature of Windows Server 2012 is really great at trimming down a Windows Server 2012 installation.

To use the “Features on Demand” you need to “remove” the binaries required by any features that aren’t currently installed by your OS. You can remove them one by one, but this is a real drag.

The following command will remove the binaries for any non-installed features on your system:

get-windowsfeature | where-object -FilterScript { $_.InstallState -eq 'Available' } | remove-windowsfeature -remove
Features on Demand Removal Progress

Features on Demand Removal Progress

Features on Demand Removal Complete

Features on Demand Removal Complete

After you’ve run this command you’ll need to have your windows install source available if you want to install any additional features. You might also need to specify an alternate source location when installing any future features. For more information on installing windows features from an alternate source, see this article on TechNet:

Install or Uninstall Roles, Role Services, or Features

I usually like to run this command when I’m preparing a new VM template after I’ve installed all the features I think will be needed for this VM. This results in a smaller deployment footprint.

One thought on “Remove all Uninstalled Feature Binaries

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