Display AD Group and Member Count

Welcome Forums General PowerShell Q&A Display AD Group and Member Count

This topic contains 1 reply, has 2 voices, and was last updated by

1 week, 4 days ago.

  • Author
  • #156710

    Topics: 6
    Replies: 5
    Points: 48
    Rank: Member


    I'm trying to write a script to display the AD group name and the count of members in the group.  I'd like to do this for multiple groups, if possible.

    This code displays the count for 1 AD group.

    $ADGroupCnt = (Get-ADGroupMember -Identity "Group Name").count

    Is there any way the code can be changed to include multiple groups and their member count?


    AD Group  Count
    Group1   300
    Group2  400



  • #156717

    Topics: 1
    Replies: 1333
    Points: 1,690
    Helping Hand
    Rank: Community Hero
    $ListOfGroups = @(
    foreach ($Group in $ListOfGroups) {
            Name = $Group   
            Count = (Get-ADGroupMember -Identity $Group).count

    You may start to learn the very basics of Powershell first.

You must be logged in to reply to this topic.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort