Kae Travis

Find the Membership Count of all AD Groups in an OU

Posted on by in PowerShell

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). I wrote a PowerShell script to find the membership count of all AD Groups in an 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
}

 

Find the Membership Count of all AD Groups in an OU
Find the Membership Count of all AD Groups in an OU

Leave a Reply