how to export user list from active directory windows 2003

how to export user list from active directory windows 2003
anupliAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Will SzymkowskiSenior Solution ArchitectCommented:
You can use the "dsquery user"command to achieve this. See below link for syntax
https://technet.microsoft.com/en-ca/library/cc725702.aspx

Will.
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization ConsultantCommented:
We use this AD Reporting Tool!

for free!

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Will SzymkowskiSenior Solution ArchitectCommented:
So an example will look like below...

dsquery user -name * > "c:\ADUsers.csv"

Open in new window


Pretty easy.

Will.
Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

anupliAuthor Commented:
Thank you for your inputes
When I run below command I am getting error as mentioned below

C:\>dsquery user -name * > "c:\ADUsers.csv"
Dsquery has reached the default limit of 100 results to display; use the -limit option to
display more results.


If I want to get usernames under particular group and in that too if I want to export details mentioned in the description field. What would be the command to get this output. Please suggest the path forward.
dan_blagutCommented:
Or you can use the old csvde command
CSVDE -f adusers.csv
http://www.computerperformance.co.uk/Logon/Logon_CSVDE_Export.htm

The only thing that you can't export is the password.

Dan
cbarber22Commented:
You can do this via a powershell script like this:

Select-Object -Property Name,SamAccountName,Description,EmailAddress,LastLogonDate,Manager,Title,Department,whenCreated,Enabled,Organization | Sort-Object -Property Name | ConvertTo-CSV

Alternate: hyena is a great tool I've used in previous client environments.
Mohammed KhawajaManager - Infrastructure:  Information TechnologyCommented:
If you are on Windows Server 2003 and there are no Win2K8 or higher DCs then your choice is DSQUERY or CSVDE (native tools).

If you have Win2K8 DC then enable AD Web Services and use PowerShell command (i.e. get-aduser) go obtain all users info.

Another option using PowerShell would be to download PowerQuest Active Directory Roles which is free and works with Windows Server 2003.  You can then use PowerShell command get-qaduser.  Download the software from:  http://software.dell.com/products/activeroles-server/powershell.aspx

Lastly, your only other option would be to use third-party software such ones from Dell, ManageEngine,etc.
Larry Struckmeyer MVPCommented:
What am I missing?

Start - Admin Tools - ADUC - Expand Domain - right click Users - Export List.

That does it for me.
Mohammed KhawajaManager - Infrastructure:  Information TechnologyCommented:
You sure could, however, it is very limited in what it returns (ie Fqdn, alias, account name, etc).
Rich RumbleSecurity SamuraiCommented:
dsquery -limit 0 filter....
But using CSVDE is a good option as pointed out above too, it will output most of AD to a CSV file.

You can use powershell as well

Get-ADUser -Filter * -Properties mail, name| Select mail, name|export-csv users.csv

That will get the users name and email address into a CSV, remove "mail" and only get users names (first/last), for userID's use "samaccountname" instead of name.
-rich
Will SzymkowskiSenior Solution ArchitectCommented:
Use my original post but add -limit 0 at the end see below...
dsquery user -name * -limit 0 > "c:\ADUsers.csv"

Open in new window


Will.
Larry Struckmeyer MVPCommented:
Start - Admin Tools - ADUC - Expand Domain - right click Users - Export List.

You sure could, however, it is very limited in what it returns (ie Fqdn, alias, account name, etc).

But it answers the original question.  <g>.
Spike99On-Site IT TechnicianCommented:
Going to the OU to get a list of users is a problem when all the users aren't in the same OU.   You could go to each OU that contains users and export the list for each one, but that's a pain.

You can do a custom LDAP query to get a list of users. Then, customize the view settings to see the columns you want (Display name, user name, email address, etc.) by clicking on View > Add/Remove Columns.  When you have the view settings the way you like them, right click the query name and then click export.

This page has some screenshots on how to set up a custom query to see all users:
http://anandthearchitect.com/2008/07/02/list-all-active-users-in-a-domain/

Basically, the steps are:
1.  Open ADUC
2.  Right click "Saved Queries" and then click on "New Query"
3.  Name the query and click on "Define Query" button
4.  Select Custom Search in the "Find" drop down list.
5.  Click on the Advanced tab
6.  Paste the query you want to use into the "Enter LDAP Query" text box

The query he uses in that example is:
(&(&(objectCategory=user)(userAccountControl=512)))

This will produce a list of all active users (leaving out any disabled accounts).

If you want a list of ALL users, including disabled accounts, this query worked for me:
(&(&(objectCategory=user)))

Then, set up the column headings the way you want and right click on the query name & then click on Export.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Batch

From novice to tech pro — start learning today.