How Many Users in AD? (User Count)

KB ID 0001748

Problem

I had to get some stats from a number of customers earlier today, one of the stats I needed was the  user count from within their respective Active Directories. If you have a tedious job to do, there’s usually a PowerShell command to help!

Getting Object Numbers From Active Directory

User Count

(Get-ADUser -Filter *).Count

Computer Count

(Get-ADComputer -Filter *).Count

Group Count

(Get-ADGroup -Filter *).Count

Get Active Directory User Count

Enabled or Disabled User Count

That’s all fine, but what if you needed to only see enabled or disabled users?

(Get-AdUser -filter ‘Enabled -eq $true’).count
(Get-AdUser -filter ‘Enabled -eq $false’).count

Group User Count

Or only users in a particular group?

(Get-ADGroup GS-VPN-Users -Properties *).Member.Count

OU User Count

Or only users in a particular OU?

(Get-ADUser -Filter * -SearchBase “OU=Users, OU=PNL,DC=pnl,DC=com”).Count

Get Active Directory Group or OU User Count

Related Articles, References, Credits, or External Links

NA

Author: PeteLong

Share This Post On

Submit a Comment

Your email address will not be published. Required fields are marked *