Skip to Content

Solved: How do I list details of group members in AD group and subgroup

Question

I have an Active Directory (AD) group which contains a lot of group members and also SUBGROUPS. I need to list all of them out. I am testing below cmdlet but it stops when listing subgroup’s member.

Import-Module ActiveDirectory
Get-ADGroupMember -Identity "account operators" | Get-ADUser -Property name, UserPrincipalName |Select-Object name, UserPrincipalName

Solved: How do I list details of group members in AD group and subgroup

I like to know how to list the group members name, UPN, subgroup name and indicate the name as subgroup?

Solution

This will have column ObjectClass, which will be either user or group:

Get-ADGroupMember -Identity "Account Operators" |
Get-ADObject -Property SamAccountName, UserPrincipalName |
Select-Object -Property Name, SamAccountName, UserPrincipalName, ObjectClass, DistinguishedName

    Ads Blocker Image Powered by Code Help Pro

    Ads Blocker Detected!!!

    This site depends on revenue from ad impressions to survive. If you find this site valuable, please consider disabling your ad blocker.