VB Script that pulls all Usernames from all OU's in Active Directory.

Posted on 2013-01-23
Last Modified: 2013-01-23
Hello I am looking for a way to pull all users from all OU's in active directory and was wondering if anyone had a VBScript that they would be willing to share.  Any help would be appreciated thanks.
Question by:Don Coleman
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 55

Expert Comment

ID: 38812237
The question will be "what should the output look like?".
A simple batch command "net user" will do when executed at a domain controller.

Author Comment

by:Don Coleman
ID: 38812284
Sorry meant to put that in the question I would like it to output to a txt or a csv file if possible thanks.
LVL 55

Expert Comment

ID: 38812304
no, I mean, is the layout of the output of any importance?
See, for example
net user >%temp%\users.txt
 will produce a textfile with 3 columns.
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.


Author Comment

by:Don Coleman
ID: 38812405
I would prefer just one column I only need the username but 3 columns will work if not possible to do 1.
LVL 55

Accepted Solution

McKnife earned 500 total points
ID: 38812463
Well, I cannot figure out a script to get one column from net user, so take the command
dsquery user
that produces one column.

Author Comment

by:Don Coleman
ID: 38812545
Ok thanks for the help

Featured Post

Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

Question has a verified solution.

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

Had a business requirement to store the mobile number in an environmental variable. This is just a quick article on how this was done.
Here's a look at newsworthy articles and community happenings during the last month.
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 from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

729 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