If you have used Windows Server 2008, probably you had experience with managing server features. Server Manager is a traditional way to install/uninstall server features. On Windows 2008 Server R2 Beta, Windows PowerShell provides a new approach to managing server features via Server Manager PowerShell cmdlets. This blog will walk through installing server features with these cmdlets.
To use the Server Manager cmdlets, we need to import servermanager module by running the PowerShell command “Import-Module servermanager”. The reason is that these cmdlets are encapsulated in the servermanager module, and are not a part of PowerShell build-in cmdlets.
From the console shot above, we can see servermanager module contains three PowerShell cmdlets. Then running “Get-WindowsFeature” will give us a list of Windows feature names. Since this will generate a long list, I will not put the screenshot here. Take .NET Framework 3.5.1 as an example, the feature name is “NET-Framework”. We can go ahead and install this feature. One caveat is you have to run PowerShell as administrator to make “Add-WindowsFeature” work.
After the last cmdlet is complete, [X] in the “Display Name” indicates the feature has been added. To be sure, you can always double check with the Server Manager UI. BTW, These cmdlets also work with managing server roles. An example is “Add-WindowsFeature Web-Server” will install Web Server (IIS) role.
It is easy, huh?
Windows PowerShell Team