How to get a list of users in Active Directory?

Gorilla Pound

Solid State Member
Messages
14
Hello all, I am trying to get a list of all the users and the groups they belong to within our OU...

I recall a long while back when I was using Server 2000 that I had to do some type of text file creation through the command prompt to get the list, but I am hoping that within Server 2003 that there is an easier way to print the list of users.

Is there a simple way in 2003 to get a list of users and their group memberships in the AD? Or if the manual command prompt way is the only way to do it, can someone tell me the steps? Thanks.
 
Try this, and see if that works.

Option Explicit

Dim objDSE, strDefaultDN, strDN, objContainer, objChild

Set objDSE = GetObject("LDAP://rootDSE")
strDefaultDN = "CN=Users," & objDSE.Get("defaultNamingContext")

strDN = InputBox("Enter the distinguished name of a container" & _
vbCrLf & "(e.g. " & strDefaultDN & ")", , strDefaultDN)

If strDN = "" Then WScript.Quit(1) 'user clicked Cancel

Set objContainer = GetObject("LDAP://" & strDN)

objContainer.Filter = Array("user")
For Each objChild In objContainer
WScript.Echo objChild.Name & vbTab & objChild.Description
Next

That will list all the users in one container.
 
Its a VBScript. Copy paste that into a txt document. then Save As blah.vbs but make sure you edit that script to fit your needs(Domain etc..)
 
uid=[0] said:
Its a VBScript. Copy paste that into a txt document. then Save As blah.vbs but make sure you edit that script to fit your needs(Domain etc..)
Gotcha. Thank you very much for your help, I will try that. Now where exactly would I save it...and once saved as a txt file, how would it run or be executed?
 
save the text to a .txt file. then Save As blah file type "All files" then type it in the save dialog as blah.vbs Once you do that, just double click on it, and it will run it.
 
Gorilla Pound said:
Hello all, I am trying to get a list of all the users and the groups they belong to within our OU...

I recall a long while back when I was using Server 2000 that I had to do some type of text file creation through the command prompt to get the list, but I am hoping that within Server 2003 that there is an easier way to print the list of users.

Is there a simple way in 2003 to get a list of users and their group memberships in the AD? Or if the manual command prompt way is the only way to do it, can someone tell me the steps? Thanks.

Running usrmgmt should give you a list, but it will not givetell you what their permissions are.
 
Back
Top Bottom