Answer the question
In order to leave comments, you need to log in
How to compose an LDAP filter by DistinguishedName?
I've been scratching my head for the second day and can't find the information I need. I need to exclude several nested OUs in a request to the domain and get the rest of the OUs along with users. I read about LDAP filtering and made my own. The "users only" filter works:
$filter = "(&(objectCategory=person)(objectclass=user))";
$dn = "dc={$adServerShort},dc=local";
$result = ldap_search($ldap, $dn, $filter);
$info = ldap_get_entries($ldap, $result);
foreach($info[0] as $item) {
echo "<pre>";
print_r($item);
echo "</pre>";
}
$filter = "(&(objectCategory=person)(objectclass=user)(dn=&(!(*OU=OFF_User*))(!(*OU=Service*))))";
Answer the question
In order to leave comments, you need to log in
Compiled an algorithm that receives a complete list of accounts in the domain and then forms a filtered list from it without accounts in the specified OUs
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question