Skip to Content

PowerShell Command for User Count, Computer Count, and Group Count in Active Directory

Problem: How to list the number of user count, group count, and computer count within respective Active Directory using PowerShell command. Execute the list of PowerShell command in this article to display the object numbers from Active Directory.

Getting Object Numbers From Active Directory

User Count

(Get-ADUser -Filter *).Count

Computer Count

(Get-ADComputer -Filter *).Count

Group Count

(Get-ADGroup -Filter *).Count

PowerShell Command for User Count, Computer Count, and Group Count in Active Directory

PowerShell Command for User Count, Computer Count, and Group Count in Active Directory

Enabled or Disabled User Count

Count on enabled or disabled users:
(Get-AdUser -filter ‘Enabled -eq $true’).count
(Get-AdUser -filter ‘Enabled -eq $false’).count

Group User Count

Count only users in a particular group:
(Get-ADGroup GS-VPN-Users -Properties *).Member.Count

OU User Count

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

PowerShell Command for Group User Count and OU User Count.

PowerShell Command for Group User Count and OU User Count.