Windows Server comes with a wealth of Roles and Features. In many cases not everyone uses all of the Roles or Features on every server deployed, physical or virtualized. So the question is why keep around that content? For virtualized environment saving space is definitely beneficial. Even if you remove the Available Roles & Features they can be added back easily.
I suggest first running Get-WindowsFeature to check that you have all of the Roles & Features that you need currently.
Get-WindowsFeature
Now once that has been validated the following PowerShell will remove any Role or Feature that has an Install State = Available.
Get-WindowsFeature | Where-Object -FilterScript {$_.Installed -Eq $FALSE} | Uninstall-WindowsFeature -Remove Restart-Computer
After restarting the Windows Server run the following to verify that the Available features show Removed.
Get-WindowsFeature
And a final check to see only the Windows Roles & Features that are Installed.
Get-WindowsFeature | Where-Object -FilterScript { $_.Installed -Eq $TRUE }
Need to add a specific Role & Feature back use Install-WindowsFeature cmdlet as follows:
Install-WindowsFeature -Name Failover-Clustering -IncludeSubFeature -Source <ISO-Location> Install-WindowsFeature -Name RSAT-Clustering -IncludeAllSubFeature -IncludeManagementTools -Source <ISO-Location>
The -Source parameter needs to point to an ISO or the local WinSXS folder if that is still on the system.
—Barkz