Solved

Domain users list

Posted on 2010-09-21
6
786 Views
Last Modified: 2012-05-10
I need to print a list of all domain users in AD can someone help me do this?

Thank You.
0
Comment
Question by:narce100
6 Comments
 
LVL 4

Expert Comment

by:rstjean
ID: 33731303
download http://download.sysinternals.com/Files/AdExplorer.zip

Then there is a work around to export the list

To quote "auteri" here http://forum.sysinternals.com/active-directory-explorer_topic22035_post116397.html

I found a way to use and export the AD Explorer query to text.

1. Create a query in ADExplorer
2. Copy ADExplorer query string (Just Under Value field)
3. Open Active Directory users and computers (dsa.msc)
4. Create new query under "Saved Queries"
5. Choose Define Query > Find "Custom Search" > Advanced Tab
6. Enter LDAP Query > Paste ADExplorer query string
7. Save query
8. Export with: Export List

Its a workable solution altough having a export button in ADExplorer would be better.
Mark, if you read this, please put export in there with a xml or csv version (or even better both).
0
 
LVL 14

Expert Comment

by:athomsfere
ID: 33731310
I would say dstools would be the easiest, below is a rough command to do it, but it would be a batch file to copy users samid, lastname and firstname to a txt file.

dsquery user "cn=users,ou=users,dc=company" | dsget user -samid -ln -fn >> users.txt
0
 
LVL 57

Accepted Solution

by:
Mike Kline earned 500 total points
ID: 33731471
I helped with a similar question yesterday, in my example I used adfind    

http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_26487114.html

Thanks

Mike
0
 
LVL 11

Expert Comment

by:farjadarshad
ID: 33731714
you can do this by following command

NET USERS /DOMAIN >c:\user.txt (the command generate a text file on root of c: with required information)

NET ACCOUNTS /DOMAIN>c:\account.txt (for domain accounts)

NET config server /DOMAIN>c:\server.txt (for domain servers)
0
 
LVL 5

Expert Comment

by:balmasri
ID: 33742929
Try this following scripts:
Set objExcel = CreateObject("Excel.Application")



objExcel.Visible = True



objExcel.Workbooks.Add



intRow = 2



 



objExcel.Cells(1, 1).Value = "User Name"



objExcel.Cells(1, 2).Value = "Full Name"



objExcel.Cells(1, 3).Value = "Description"



 



strDomain = InputBox ("Enter Domain Name")



Set DomObj = GetObject("WinNT://" & strDomain ) 



DomObj.Filter = Array("User") 



For Each objUser In DomObj 



objExcel.Cells(intRow, 1).Value = objUser.Name



objExcel.Cells(intRow, 2).Value = objUser.FullName



objExcel.Cells(intRow, 3).Value = objUser.Description



intRow = intRow + 1



Next 



 



objExcel.Range("A1:C1").Select



objExcel.Selection.Interior.ColorIndex = 19



objExcel.Selection.Font.ColorIndex = 11



objExcel.Selection.Font.Bold = True



objExcel.Cells.EntireColumn.AutoFit



 



MsgBox "Done"

Open in new window

0
 

Author Closing Comment

by:narce100
ID: 33761727
I followed the link and did some modifications and after testing a few times I got what I wanted
0

Join & Write a Comment

The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
To efficiently enable the rotation of USB drives for backups, storage pools need to be created. This way no matter which USB drive is installed, the backups will successfully write without any administrative intervention. Multiple USB devices need t…
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…

760 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

20 Experts available now in Live!

Get 1:1 Help Now