September 2003
Intermediate to advanced
624 pages
15h 49m
English
You want to find objects that match certain criteria in a domain.
Open LDP.
From the menu, select Connection → Connect.
For Server, enter the name of a domain controller (or leave blank to do a serverless bind).
For Port, enter 389.
Click OK.
From the menu, select Connection → Bind.
Enter credentials of a user.
Click OK.
From the menu, select Browse → Search.
For BaseDN, type the base distinguished name where the search will start.
For Scope, select the appropriate scope.
For Filter, enter an LDAP filter.
Click Run.
> dsquery * <BaseDN> -scope <Scope> -filter "<Filter>" -attr "<AttrList>"
' This code searches for objects based on the specified criteria. ' ------ SCRIPT CONFIGURATION ------ strBase = "<LDAP://<BaseDN>>;" ' BaseDN should be the search base strFilter = "<Filter>;" ' Valid LDAP search filter strAttrs = "<AttrList>;" ' Comma-seperated list strScope = "<Scope>" ' Should be on of Subtree, Onelevel, or Base ' ------ END CONFIGURATION --------- set objConn = CreateObject("ADODB.Connection") objConn.Provider = "ADsDSOObject" objConn.Open "Active Directory Provider" set objRS = objConn.Execute(strBase & strFilter & strAttrs & strScope) objRS.MoveFirst While Not objRS.EOF Wscript.Echo objRS.Fields(0).Value objRS.MoveNext Wend
Most tools that can be used to search Active Directory require a basic understanding of how to perform LDAP searches using a base ...