Remove unused role and feature payload files from WS 2012

Remove unused role and feature payload files from WS 2012

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

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish