?
Solved

Active Directory Query

Posted on 2012-03-13
5
Medium Priority
?
323 Views
Last Modified: 2012-03-13
I need to run a query in Active Directory that will retrieve user's first name, last name and their account login name and export it to a csv file.
0
Comment
Question by:jduclosjduclos
5 Comments
 
LVL 27

Expert Comment

by:KenMcF
ID: 37714861
I would use powershell and the free Quest cmdlets


get-qaduser -sl 0 | Select FirstNAme, LastName, Samaccountname | Export-csv c:\temp\users.csv -notype
0
 
LVL 57

Accepted Solution

by:
Mike Kline earned 2000 total points
ID: 37714862
Lots of great ways

I like adfind (free)    http://www.joeware.net/freetools/tools/adfind/index.htm

adfind -default -f "&(objectcategory=person)(objectclass=user)" givenname sn samaccountname -csv -nodn > c:\users.csv

adinfo is a really nice free GUI tool

http://www.cjwdev.co.uk/Software/ADReportingTool/Info.html

other methods include powershell, dstools, vbscript, csvde, and there are more.

Thanks

Mike
0
 
LVL 6

Expert Comment

by:dave_it
ID: 37715077
Using the native 2008 R2 AD cmdlets:

get-aduser -identity "xxxxxxx" -properties * | Select-Object samAccountName,givenname,surname | Export-CSV c:\temp\userid.csv
0
 
LVL 26

Expert Comment

by:Leon Fester
ID: 37715258
I'm a ldifde and csvde man myself, both are tools from Microsoft and available in the Windows resource kit

ldifde -f Exportuser.ldf -d "dc=Export,dc=com" -p subtree -r "(&(objectCategory=person)(objectClass=User)(givenname=*))" -l "cn, sAMAccountName"

ldifde -f Exportuser.ldf -d "dc=Export,dc=com" -p subtree -r "(&(objectCategory=person)(objectClass=User)(givenname=*))" -l "givenName, sn, sAMAccountName"

http://support.microsoft.com/kb/237677

CSVDE -f export3.csv -l "cn, samAccountName"
CSVDE -f export3.csv -l "givenName, sn, samAccountName"
http://www.computerperformance.co.uk/Logon/Logon_CSVDE_Export.htm
0
 

Author Closing Comment

by:jduclosjduclos
ID: 37715592
Thank you!!
0

Featured Post

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Question has a verified solution.

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

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.
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Suggested Courses

850 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