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!!!

We have detected that you are using extensions to block ads. We need money to operate the site, and almost all of it comes from online advertising. Please support us by disabling these ads blocker.

Please disable ad blocker