Windows Server 2008 R2 includes a few cmdlets (Command-lets) to manager server roles and features. Before R2, we had servermanagercmd.exe to add or remove features from command line. At the standard PowerShell console, you will not be able to access these cmdlets without importing the server manager module.
To import the cmdlets, use Import-Module ServerManager at the PowerShell Console. This will enable the following three cmdlets.
You could add a feature, for example .Net Framework, using the Add-WindowsFeature cmdlet.
That is simple..huh.!
Now, here is a limitation. For example, if I want to add RDS-Virtualization feature, using traditional Server Manager GUI, I need to add Remote Desktop Server feature and then select RD Virtualization under that. However, when you use Add-WindowsFeature RDS-Virtualization
But if you go and look at the Server Manager GUI console,
So, RDS-Virtualization is installed but without Remote Desktop Server it is of no use. Add-WindowsFeature cmdlet does not check for the dependency information.
If you look at the Get-WindowsFeature output for any given feature there are multiple properties and one such property is “DependsOn”. So, it is pretty much possible to install the remaining depending features and roles using a simple script. More on that later..!
The above underlined statement is not completely accurate. On a system with no Hyper-V role, when I tried installing RDS-Virtualization feature, Hyper-V was automatically added as RDS-Virtulaization depends on Hyper-V role. I will continue to post more on this. I am just waiting for the RC build to arrive.