Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get a list of members in Active Directory 1

Status
Not open for further replies.

omegasa

Technical User
Mar 13, 2007
29
RO

Hi,

I have a security group named Internet (win2000). I need a list with all members(name, username, group). Is there in A.D. a command to get this list ? Can someone show me a line of code in WMI or VBScript to do this ?

Thanks
 
Right click on the OU, select "Export List". Just make sure your view is set with the columns that you want.

All done.

I'm Certifiable, not cert-ified.
It just means my answers are from experience, not a book.
 
When looking for vbscript code you should try the vbscript forum. ;-)

From the Microsoft scripting center:

Code:
Dim arrNames()
intSize = 0

Set objGroup = GetObject("LDAP://CN=Accountants,OU=Finance,DC=fabrikam,DC=com")

For Each strUser in objGroup.Member
    Set objUser =  GetObject("LDAP://" & strUser)
    ReDim Preserve arrNames(intSize)
    arrNames(intSize) = objUser.CN
    intSize = intSize + 1
Next

For i = (UBound(arrNames) - 1) to 0 Step -1
    For j= 0 to i
        If UCase(arrNames(j)) > UCase(arrNames(j+1)) Then
            strHolder = arrNames(j+1)
            arrNames(j+1) = arrNames(j)
            arrNames(j) = strHolder
        End If
    Next
Next 

For Each strName in arrNames
    Wscript.Echo strName
Next

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Ack...group...not OU...you'll need Marks script.

I'm Certifiable, not cert-ified.
It just means my answers are from experience, not a book.
 
Type net group "Groupname" from the command window on a DC.You can pipe it to a txt file if you want.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top