Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to count users in specific OU in AD

Posted on 2014-04-18
3
Medium Priority
?
21,937 Views
Last Modified: 2014-04-18
Hello all,
I would like to count the total of users in specific OU in AD. I found some command online or script but it did not work.

Get-ADUser -Filter * -SearchBase "ou=Accounting,ou=administration,ou=people,dc=ncmecad,dc=net"

Please give me some hints.
Thanks,
0
Comment
Question by:dongocdung
3 Comments
 
LVL 25

Accepted Solution

by:
Zephyr ICT earned 1200 total points
ID: 40008582
If you just want to count the number of users in a OU you can use this:

(Get-ADUser -Filter * -SearchBase "ou=Accounting,ou=administration,ou=people,dc=ncmecad,dc=net").count

Open in new window

2
 
LVL 6

Assisted Solution

by:Hassan Besher
Hassan Besher earned 800 total points
ID: 40008589
0
 

Author Comment

by:dongocdung
ID: 40008718
The command from spravtek is used to have total count of users in the specific OU.
The script from the article is used to have total count of users in each OU in organization
Thanks for your help.
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A bad practice commonly found during an account life cycle is to set its password to an initial, insecure password. The Password Reset Tool was developed to make the password reset process easier and more secure.
Wouldn't it be nice if objects in Active Directory automatically moved into the correct Organizational Units? This is what AutoAD aims to do and as a plus, it automatically creates Sites, Subnets, and Organizational Units.
This tutorial will walk an individual through locating and launching the BEUtility application to properly change the service account username and\or password in situation where it may be necessary or where the password has been inadvertently change…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question