Problem
I need to write an LDAP query that given a distinguishedName
for a group
will return a list of all users
who are owners/managers of the group
Motivation
I am writing a VBA script that will allow an excel user to input a DisplayName
for a group
in a cell and press a button to receive (1) a list of members and (2) a separate list of group owners.
Progress
The first part works fine. I search the directory for all users who have the group in their memberof
field.
For the owners, I successfully pulled the group's managedBy
field, but it only contained information for a single user. This is the same user that appears in the "Owner" field when the group is viewed in Outlook's address book. There are many more users with ownership permissions for the list.
Examples
Here are the two (slightly modified) queries I'm using now:
Query 1: Group Members (works)
<LDAP://dc=DOMAIN,dc=com>;(&(memberof=CN=GroupName));DisplayName;Subtree
Query 2: Group Owners (single user returned)
<LDAP://dc=DOMAIN,dc=com>;(&(objectCategory=group)(DisplayName="Group Name"));managedBy;Subtree
The Question
How can I modify Query 2 to return all users with management permissions for the group?