In this tutorial, you will learn how to get a list of all installed roles and features using PowerShell.
This will only work on Windows server operating system and works for local and remote computers.
Let’s get started
Get-WindowsFeature
The get-windowsfeature PowerShell command will get information about installed and available features and roles.
The following command will list all server roles and features:
get-windowsfeature
As you can see in the screenshot above the command gets the display name, name, and the install state of services and roles on my local computer. The install state values can be installed, available and removed.
Display only Installed Features and Roles
You probably just want a list of installed roles and features, this can be done with the following command:
Get-WindowsFeature | Where-Object {$_. installstate -eq "installed"}
This looks much better, now it’s a list of only the features that are in the install state. What I did was filter the list based on the install state to list only those that are installed.
The display name and name are basically the same so I’m going to remove the Display name column.
Get-WindowsFeature | Where-Object {$_. installstate -eq "installed"} | select Name,Installstate
That is much easier to read.
Get Installed Roles and Features on a Remote Computer
Now let’s look at how to get installed roles for a remote computer. I’m on DC2 and I’m going to list the roles for DC1.
The command is exactly the same you just need to add -ComputerName PCNAME to the command.
Get-WindowsFeature -ComputerName dc1 | Where-Object {$_. installstate -eq "installed"} | select Name,Installstate
Now I’ve got a list of everything installed on my dc1 server.
Search for Roles and Features (Wildcard Search)
If you need to find a specific role or feature you can type in the name or do a wildcard search. In the below example I’m going to do a wildcard search for Active Directory roles. I’m not sure of the name so I’ll search for *ad*
get-windowsfeature *ad*
You can see the wildcard search listed everything that has “ad” in the name. Pretty cool option to quickly search for roles and features.
If you provide the script for the list of all DC’s that will be help full
Like this?
https://activedirectorypro.com/list-all-domain-controllers-with-powershell/
Hi
might be a bit late but
‘dc1′,’dc2’ | %{Get-WindowsFeature *ad* -ComputerName $_ | ? {$_.installstate -eq “installed”}}