Share via


How to Export Members of a Particular AD Group

1. Open PowerShell ISE on your domain controller.

2. Choose a location to save a .csv file in the last string of the following PowerShell script and type the name of the needed group.

$nameofgroup='*'
$groupsusers=get-adgroup -filter $nameofgroup |
    ForEach-Object{
                $settings=@{Group=$_.DistinguishedName;Member=$null}
        $_ | get-adgroupmember |
              ForEach-Object{
                                       $settings.Member=$_.DistinguishedName
                    New-Object PsObject -Property $settings
                }
    }
    $groupsusers | Export-Csv C:\Temp\GroupsUsers.csv -NoTypeInformation

3. Run the script.

**4. **Open a generated .csv file in Microsoft Excel.
https://img.netwrix.com/landings/howtodoit/mini/sm_NT.png

**5. **Credits: originally posted - https://www.netwrix.com/how_to_export_members_from_active_directory.html