Share via

Export the number of members of AD groups

Cosme Silva 21 Reputation points
2021-06-09T15:30:10.927+00:00

How can I export to a CSV file the number of members of AD groups?

The following command works for a group, but I need the number of members of all the groups so that I can compare the numbers after the groups are migrated between AD domains:

(Get-ADGroup <group> -Properties *).Member.Count

Windows for business | Windows Server | User experience | PowerShell
0 comments No comments

Answer accepted by question author
  1. Anonymous
    2021-06-10T01:32:50.357+00:00

    Hi,

    You can get all the groups using -Filter *.

    Get-ADGroup -Filter * -Properties Member | Select-Object Name,@{n="MemberCount";e={$_.Member.Count}}  
    

    Best Regards,
    Ian Xue

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

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