Getting the number of user accounts in Active Directory

Hi guys,
I hope you are all well and can assist.

I would like to get an accurate total of the following:

1) Total number of user accounts in Active Directory
2) Total number of disabled accounts in Active Directory

Any help greatly appreciated.

Id like to do this via a variety of methods potentially, including dsquery.

Thank you in advance.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike KlineCommented:
Several ways, adfind is a free lightweight tool with shortcuts that help

adfind -sc adobjcnt:user

Using powershell to find all users and then disabled users

get-aduser -filter * | measure-object | select-object count
get-aduser -filter 'enabled -eq $true' | measure-object | select-object count

or search-adaccount -accountdisabled | measure-object | select-object count

dsquery user -name *
dsquery user -name * -disabled



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Try this in powershell:

import-module activedirectory

$AllUserObjects = get-user -resultsize unlimited

"Total User Accounts: " + ($AllUserObjects | where{ $_.recipienttype -like "*user*"}).count

"Total Disabled Accounts: " + ( $AllUserObjects | where{ $_.UserAccountControl -like "AccountDisabled*"}).count
SandeshdubeySenior Server EngineerCommented:
You can also use this GUI tool.
Simon336697Author Commented:
Thanks so much guys.
Aubrey ChirwaCommented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Active Directory

From novice to tech pro — start learning today.