Solved

Domain users list

Posted on 2010-09-21
6
797 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
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

 
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

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Synchronize a new Active Directory domain with an existing Office 365 tenant
Find out how to use Active Directory data for email signature management in Microsoft Exchange and Office 365.
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…
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 from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…

911 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

21 Experts available now in Live!

Get 1:1 Help Now