how to export user list from active directory windows 2003

anupli
anupli used Ask the Experts™
on
how to export user list from active directory windows 2003
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Will SzymkowskiSenior Solution Architect
Most Valuable Expert 2015
Top Expert 2015

Commented:
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.
VMware and Virtualization Consultant
Fellow 2018
Expert of the Year 2017
Commented:
We use this AD Reporting Tool!

for free!

http://www.cjwdev.co.uk/Software/ADReportingTool/Info.html
Will SzymkowskiSenior Solution Architect
Most Valuable Expert 2015
Top Expert 2015

Commented:
So an example will look like below...

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

Open in new window


Pretty easy.

Will.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

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.
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
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 Technology

Commented:
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.
What am I missing?

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

That does it for me.
Mohammed KhawajaManager - Infrastructure:  Information Technology

Commented:
You sure could, however, it is very limited in what it returns (ie Fqdn, alias, account name, etc).
Rich RumbleSecurity Samurai
Top Expert 2006

Commented:
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 Architect
Most Valuable Expert 2015
Top Expert 2015

Commented:
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.
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 Technician

Commented:
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.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial