Export multiple AD groups and 'Member of'

Nivan Jordan 1 Reputation point
2022-05-26T16:29:10.387+00:00

Good Afternoon

I have multiple AD Security groups (about 9) that have other groups in it that is listed under the 'Member of' tab.

I would like to export these 9 groups into a csv that shows all the 'members of' each group.

I haven't found a proper script that is able to do this, can you help me please?

Windows for business | Windows Server | User experience | PowerShell
{count} votes

1 answer

Sort by: Most helpful
  1. Newbie Jones 1,386 Reputation points
    2022-05-27T12:48:30.547+00:00

    Something like..

    $groups = "GroupA", "GroupB", "GroupC"  
      
    ForEach ($group in $groups) {  
        Get-ADGroupMember $group |  
            Where-Object {$_.objectClass -eq 'Group'} |  
                Select-Object @{name="Group";expression={$group}}, @{name="Embedded Group";expression={$_.Name}}  
    }  
    

    206262-image1.png

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.