How to count number of objects in active directory

Last modified date

How to count number of objects in active directory

How to count how may objects in AD? How many users, computers and group?

Due to compliance or Asset/inventory/License management purpose we always need a count of system we have in our environment. If you are running Microsoft Windows platform and has Active Directory environment. So, best solution is “Get-AD” power-shell command.

Commands are:

(Get-ADUser -Filter *).Count
(Get-ADGroup -Filter *).Count
(Get-ADComputer -Filter *).Count
(Get-ADObject -SearchBase "cn=Configuration,dc=mydomain,dc=com" -LDAPFilter "(objectClass=site)").Count
(Get-ADObject -SearchBase "dc=Mydomain,dc=com" -LDAPFilter "(objectCategory=*)").Count
  



Ravi Chopra

1 Response