Home » General Scripting and Coding » PowerShell » Find Membership Count of all AD Groups in OU

Find Membership Count of all AD Groups in OU

Posted on by

I was working on an application migration recently, and wanted to see how many users/computers were in each application Active Directory (AD) group in a specified Organisational Unit (OU):

$Groups = Get-ADGroup -Properties * -Filter * -SearchBase "OU=Applications,DC=alkane,DC=co,DC=uk" 
Foreach($group In $groups)
{
    $groupname = $group.Name 
    $groupdescription = $group.Description
    $groupdn = $group.DistinguishedName
    $groupcount = $group.member.count
}

 

Comments have now been disabled. If you have a question to ask about this post please ask the community!