When investigating an existing domain for a potential upgrade or clean-up, it’s necessary to gauge the number of Active Directory (AD) objects in order to decide how many domain controllers are needed. This is also just useful information to occasionally check in order to keep track of your AD growth percentage.
How to Check Your Active Directory Counts
Log in to any of your domain controllers, and bring up PowerShell as an Administrator. Enter the following commands to quickly check the counts for each category:
(Get-ADUser -Filter *).Count (Get-ADGroup -Filter *).Count (Get-ADComputer -Filter *).Count
This format can also be used to count the number of users in an AD group:
(Get-ADGroup <group> -Properties *).Member.Count
Or the number of users in a specific Organizational Unit (OU):
(Get-ADUser -Filter * -SearchBase “OU=Users,DC=example,DC=com”).Count
This PowerShell command should work on most Windows Server versions; it’s been tested on 2008 R2, 2012 R2 and 2016.