Directory Services

Finding Objects by Name

Most Active Directory objects use the cn property as their naming attribute. Some objects, however, use a naming attribute other than cn. For example, a domain controller uses the domainDNS property for the naming attribute and an organizational unit uses the organizationalUnit property for the naming attribute. To avoid having to use a different naming attribute for different object types, the name property, which contains the relative distinguished name of the object, should be used to search for objects by name.

Examples

The following examples demonstrate different query strings that can be used to find objects by name.

The following query string finds all objects with a name that begins with "Jeff".

(name=Jeff*)

The following query string finds all computer objects with a name that begins with "leased" or "corp".

(&(objectCategory=computer)(|(name=leased*)(name=corp*)))

The following filter finds all users and with a name that begins with "Karen" or "Jeff".

(&(&(objectClass=user)(objectCategory=person))(|(name=Karen*)(name=Jeff*)))