Q. How can I add and remove Windows roles and features from PowerShell in Windows Server 2008 R2?

John Savill

January 18, 2010

1 Min Read
ITPro Today logo in a gray background | ITPro Today

A. Server 2008 R2 introduces PowerShell cmdlets for the management of Roles and Features. To use them, you just need to import the ServerManager library in PowerShell:

Import-Module servermanager

You can now add and remove roles and features using the Add-WindowsFeature and Remove-WindowsFeature cmdlets. To check all the available roles and features and their install statuses, use the Get-WindowsFeature cmdlet. If the feature is installed, an [X] is displayed, as the sample below shows.



The name on the right side is the name needed to install or remove the feature. For example,

Add-WindowsFeature Hyper-V

would install Hyper-V.

Related Reading:

  • Protect Your PowerShell Scripts

  • Get-ChildItem's -Include Parameter

  • Q. Can I use the Windows Server 2008 R2 PowerShell modules to manage a Server 2008 cluster? Can I run them on a Server 2008 server?



Check out hundreds more useful Q&As like this in John Savill's FAQ for Windows. Also, watch instructional videos made by John at ITTV.net.

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like