PowerShell Get-ADGroupMember gets a active directory group members, members can be users, groups or computers. To get ad group members displayname, we need to use PowerShell Get-ADUser cmdlet.
In this article, I will explain you how to get ad group members displayname from active directory in PowerShell.
Get-ADGroupMember only gets active directory group members, to get ad group members properties, we need to use other active directory cmdlets in PowerShell.
Use PowerShell Get-AdUser cmdlet, to get active directory user properties.
Use PowerShell Get-ADGroup cmdlet, to get active directory group properties.
Use PowerShell Get-ADComputer cmdlet, to get active directory computer properties.
Get AD Group Member DisplayName for User
Using PowerShell Get-ADGroupMember and Get-AdUser cmdlet to get ad group member displayname for user, run below command
Get-ADGroupMember -identity Administrators -Recursive | Get-ADUser -Property DisplayName | Select Name, DisplayName
In the above PowerShell command, Get-ADGroupMember cmdlet gets all the members of administrators active directory group and nested group using
Recursive parameter. It then pass output of ad group members to second command.
Second command, uses PowerShell Get-ADUser cmdlet to get DisplayName properties for user objects and pass output to third command.
Third command, select Name and DisplayName of user and list displayname of users on console and if required export ad user to csv file.
PowerShell Get-ADGroupMember cmdlet gets ad group members and using Get-ADUser cmdlet to get ad group members displayname in PowerShell.
You can find more topics about PowerShell Active Directory commands and PowerShell basics on ShellGeek home page.