Remove unused role and feature payload files from WS 2012
Windows Server 2012 allows you to remove the installation files for roles and features that you don't use. Here's a one line Windows PowerShell command that will do it for you.
June 8, 2013
Once you’ve deployed a server, such as a DC or a File Server, chances are that you won’t need to add any additional roles and features to that server. The Features on Demand technology of Windows Server 2012 allows you to remove the installation files for roles and features that you don't use. You can free up around 2 GB on some servers by removing these files. You can also add the files back in future should it be necessary.
The following Windows PowerShell command will remove all roles and feature payload files on the server that are not currently installed. It does this by figuring out the list of roles and features that aren’t installed and piping them across to the uninstall-windowsfeature cmdlet with the Remove option. To get this to work, you’ll need to run it from an elevated Windows PowerShell prompt.
Get-WindowsFeature | Where-Object {$_.Installed –eq $False} | Uninstall-WindowsFeature -Remove
About the Author
You May Also Like