Installing a Server Role and its required features using PowerShell

Using the GUI is awesome when you have to do the process a couple of times, but if you have to repeat that several times, then PowerShell is the way to go. In this Tutorial we are going over the process to show how to install the a role (DHCP) and its features using PowerShell.


When using the GUI, we can always select the role using Add Roles and Features Wizard and a dialog box asking to add the additional features will be displayed, as shown in the image below.


If we want to repeat the same process with a single PowerShell line we can use the following cmdlet:

Add-WindowsFeature DHCP –IncludeManagementTools