Share via

Export multiple AD groups and 'Member of'

Nivan Jordan 1 Reputation point
May 26, 2022, 4:29 PM

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 Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,598 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Newbie Jones 1,366 Reputation points
    May 27, 2022, 12:48 PM

    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.