Q: How can I remove unused roles and features from my customized Windows Server installation to reduce the disk footprint?

Here's a command you can use to remove all roles and features not installed on a server from disk. That doesn't mean you should, however.

John Savill

December 27, 2012

1 Min Read
Q: How can I remove unused roles and features from my customized Windows Server installation to reduce the disk footprint?

A: Windows Server 2012 allows for roles and features to be removed from the Windows side-by-side assembly, if they are known to not be needed. This can be done to reduce the disk footprint of a server. (Typically all roles and features are copied to disk even if not installed, to enable fast role and feature installation and consistent patching).

To actually remove all roles and features not installed on a server from the disk, you can use the Windows PowerShell command below. Note that this is not something you should typically do--because later, if you add a removed role or feature, then the bits (e.g., the executables, DLLs) will by default downloaded from Windows Update over the Internet.

Here's the command:

Get-WindowsFeature | Where-Object {$_.Installed -match "False"} | Uninstall-WindowsFeature -Remove

Windows PowerShell Interface Showing Removal Command

Mark Minasi has been writing a series about using PowerShell. Check out "Automating PowerShell Reports Part 1."

 

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like