How do I pull properties of group members using get-adgroupmember?


I have a specific group that has multiple groups as members. I need to pull a list of the member groups along with the gidNumber attribute for each of those groups. I can run the following line but while it does produce a column for gidNumber that column is blank.

Get-ADGroupMember -Identity Executives | select Name, gidNumber | Sort-Object -Property gidNumber

What's the best way of handling this, do I need to run a for loop in order to pull the information from each of the members?

3 Replies
best response confirmed by Baron164 (Contributor)

Gidnumber is not present as output of the Get-ADGroupMember, it is present when running (Get-ADgroup executives -properties *).member (or .members)


Thanks, I ended up doing this and it seems to be working.

(Get-ADgroup Executives -properties *).member | Get-ADGroup -Properties DisplayName,gidNumber | select DisplayName,gidNumber


Nice, you could do (Get-ADgroup Executives -properties Member) to speed things up a little, that selects the normal values and the member one as extra. Please mark my answer as solution to mark this as solved.