Install roles and features in PowerShell
Installing Windows Server’s Features and Roles through PowerShell.
In this tutorial we will discuss how to add Windows server’s roles via PowerShell.
To install these features follow the steps below.
- By using Install-WindowsFeature command you can install every role and feature in Windows Server. The Install-WindowsFeature command structure is as follows.
Install-WindowsFeature [Feature Or Role Name] -Source [Source Address]
For example, to install DHCP we can use below command:
Install-WindowsFeature DHCP -Source wim:d:\sources\install.wim:4
By using the above command, DHCP will be installed on the server. There are a few points to note in this recipe.
Note 1: Source’s address has been started with wim phrase which means we will give a wim file address. (The wim is a file-based disk image format. It was developed by Microsoft to help deploy Windows Server)
Note2: At the end of the address, the phrase :4 has been added which point to an index of installed windows version.
Now you are able to install these roles and features with PowerShell or Windows Server’s Core and Nano editions.