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](https://www.alkanesolutions.co.uk/wp-content/uploads/2023/12/find-the-membership-count-of-all-ad-groups-in-an-ou-300x169.png)
![Find the Membership Count of all AD Groups in an OU](https://www.alkanesolutions.co.uk/wp-content/themes/twentyeleven-child/images/application-packaging-services-blog.png)