Question : total of user accounts in active directory

I want to count total of user numbers in active directory with powershell script,except of title which is managers and head sections..how can we do this?

Answer : total of user accounts in active directory

While that link is a good start it is horribly bad performance.

If you are going to do a good bit of AD management I would strongly recommend getting the Quest cmdlets for Free from www.quest.com/powershell

Below is the native way to get the count. Not sure what else you are after.


1:
2:
3:
$searcher = new-object DirectoryServices.DirectorySearcher([ADSI]"","(objectCategory=user)",@("1.1"))
$searcher.PageSize = 1000
($searcher.findall()).count
Open in New Window Select All
Random Solutions  
 
programming4us programming4us