Platform SDK: Active Directory, ADSI, and Directory Services

Example Code for Filtering Objects by Name

The following filter finds all objects:

(objectClass=*)

The following filter finds all computers:

(objectCategory=computer)

The following filter finds all users and groups (note how an expression can be contained by another expression):

(|(&(objectClass=user)(objectCategory=person))(objectCategory=group))

The following filter finds all computers with names that begin with leased or corp:

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