Skip to main content
PowerShell

Add Windows Server Features using PowerShell

Working on my XenDesktop 5.6 Desktop Controller with Powershell I needed to access the Active Directory to manage groups. Trying to import the ActiveDirectory module failed as the Remote Server Administration Tools hadn’t been added to the server. Working in Windows our first thought often tends to be to reach for the GUI ; I resisted this urge preferring to import Server Manager into PowerShell.

I like the consistency, Server Manager is the GUI tool and the PowerShell module that we use to add the features we need.

Import-Module ServerManager

With this loaded I can list the features, both installed and not installed

Get-WindowsFeature

To reduce the list we can use standard wild card globbing

Get-WindowsFeaure RSAT-AD*

Now we can see that we have to install the feature RSAT-AD-PowerShell

Add-WindowsFeature RSAT-AD-PowerShell

The reality is that this is now more difficult and probably quicker than the GUI and we just need practice, but now I am happy to load the PowerShell module for AD

Import-Module ActiveDirectory

It does not matter if we use Linux or Windows but we do need to make the effort to use the command line if we are to become truly proficient and PowerShell is becoming a real alternative to the GUI.