yawnmoth wrote:
OU=Distribution Lists,DC=subdomain,DC=domain,DC=tld contains a bunch
of mailing lists. There's a member field that, itself, contains
entries like this:
CN=Lastname Firstname,OU=People,DC=subdomain,DC=domain,DC=tld
I could take each of those entries and do a separate query for each of
them, but I'd prefer not to - I'd prefer it if I could do everything
in one step. Kinda like how JOINs do make it so you can do what would
otherwise be a bunch of separate queries in a single query
-------
In the OU "ou=Distribution Lists" are group objects. Each group object has a
member attribute, which is a collection of DN's of members. Given each
member DN, I don't see what query is needed. You can either list all member
DN's, or bind to the corresponding member object with the DN and retrieve
the values of other attributes of the member. If the aim is to retrieve
other attributes of the members, the best method I can think of is to bind.
Any kind of query/search would be slower. In fact, ADSI provides the Members
method of the IADsGroup object, which is a collection of member objects. In
VBScript:
=========
Set objOU = GetObject("LDAP://OU=Distribution
Lists,DC=subdomain,DC=domain,DC=tld")
objOU.Filter = Array("group")
For Each objGroup In objOU
Wscript.Echo "Group: " & objGroup.distinguishedName
For Each objMember In objGroup.Members
Wscript.Echo " " & objMember.distinguishedName & " (" &
objMember.Class & ")"
Next
Next
=======
I added the "Class" of the member, just to show you can document any
attributes of the members you like. Just remember that members can be users,
contacts, groups, or even computers (in general). You could document the
sAMAccountName (pre-Windows 2000 logon name) for example, but contact
objects do not have this attribute.