Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Querying AD for name

Posted on 2009-03-30
4
Medium Priority
?
222 Views
Last Modified: 2012-05-06
I want to create a query using dsquery that outputs to a txt file the username and name of all users in AD.

Any help greatly appreciated.
0
Comment
Question by:lgmmiller
[X]
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
4 Comments
 
LVL 63

Accepted Solution

by:
SysExpert earned 252 total points
ID: 24023240
use this as a start maybe

The client request was to get ALL user information and fields from AD without OUs and groups.

They are most definitely held in active directory. The easy way to determine this would be to run the following command.

dsquery user -samid * | dsget user -fn -ln -mi

AD Field sn = Last Name

AD Field givenName= First Name

AD Field initials = Middle Initial


I hope this helps !
0
 
LVL 57

Assisted Solution

by:Mike Kline
Mike Kline earned 248 total points
ID: 24023257
I'd like to suggest a great tool called adfind by MVP Joe Richards
http://www.joeware.net/freetools/tools/adfind/index.htm
adfind -default -f  "&(objectcategory=person)(objectclass=user)" name samaccountanme -nodn -csv >  c:\Allusers.csv
That will output it all to csv file.
Thanks
Mike
0
 
LVL 1

Expert Comment

by:Joemonkey
ID: 24091393
I have this in a batch file and run it weekly or so.  It gives their first name, last name, and logon (or samaccountname if you prefer).  You'll obviously have to edit the OU line

dsquery user -name * "OU=All Users,DC=domain,dc=net" -limit 5000 | dsget user -fn -ln -samid > \\server\share\users.txt

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
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 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…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Suggested Courses

609 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