Solved

Active Directory Query

Posted on 2012-03-13
5
313 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
Comment Utility
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 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thank you!!
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Starting in Windows Server 2008, Microsoft introduced the Group Policy Central Store. This automatically replicating location allows IT administrators to have the latest and greatest Group Policy (GP) configuration settings available. Let’s expl…
[b]Ok so now I will show you how to add a user name to the description at login. [/b] First connect to your DC (Domain Controller / Active Directory Server) SET PERMISSIONS FOR SCRIPT TO UPDATE COMPUTER DESCRIPTION TO USERNAME 1. Open Active …
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now