Arbelac
Arbelac

Reputation: 1904

LDAP Query for both mail-enabled security groups and distribution mail groups

We have some security groups that are mail enabled. Because of that , I need a query within ADUC that will give me a list of all my mail-enabled security groups and distribution mail groups.

I am able to getting distribution mail groups LDAP query like below.

(&(&(&(objectClass=group)(!(groupType:1.2.840.113556.1.4.803:=2147483648)))))

Upvotes: 0

Views: 2505

Answers (1)

Tomalak
Tomalak

Reputation: 338326

Wrapped for legibility (put it back in a single line for use in Active Directory Users and Computers):

(&
    (objectClass=group)
    (|
        (&
            (groupType:1.2.840.113556.1.4.803:=2147483648)
            (mail=*)
        )
        (!
            (groupType:1.2.840.113556.1.4.803:=2147483648)
        )
    )
)

In English:

  • The objectClass is "group", AND
    • the groupType is "security" AND mail is set, OR
    • the groupType is NOT "security".

But I assume something simple like the following would also work - after all, you are looking for groups that have an email address. The group type is completely irrelevant.

(&
    (objectClass=group)
    (mail=*)
)

Upvotes: 1

Related Questions