Note that there are some explanatory texts on larger screens.

plurals
  1. POLDAP/AD filter - "objectclass not equal to" is not working
    text
    copied!<p>I am working with LDAP Active Directory and trying to list all users. I have this filter which works perfect:</p> <pre><code>(&amp;(objectclass=user)(|(memberOf=...)(memberOf=...)...)(|(userprincipalname=...)(displayname=...))) </code></pre> <p>Unfortunately, we have also a computer units and other devices present in AD with objectclass "user" so with previous filter I got all users, computers, devices, rooms, etc.</p> <p>These computer and devices have also an objectclass "computer" so I need to extend the filter with objectclass!="computer" in order to list only real users. So far I'd tried these filters, none of them working (no data returned!):</p> <pre><code>(&amp;(objectclass=user)(!objectclass=computer)(|(memberOf=...)(memberOf=...)...)(|(userprincipalname=...)(displayname=...))) (&amp;(objectclass=user)(!(objectclass=computer))(|(memberOf=...)(memberOf=...)...)(|(userprincipalname=...)(displayname=...))) (!(objectclass=computer))(&amp;(objectclass=user)(|(memberOf=...)(memberOf=...)...)(|(userprincipalname=...)(displayname=...))) (!objectclass=computer)(&amp;(objectclass=user)(|(memberOf=...)(memberOf=...)...)(|(userprincipalname=...)(displayname=...))) </code></pre> <p>(real users do not have the objectclass "computer").</p> <p>I am working with PHP ldap implementation so using an <code>ldap_search()</code> method.</p> <p>The "not equal to" syntax was found e.g. here: <a href="http://technet.microsoft.com/en-us/library/aa996205%28EXCHG.65%29.aspx" rel="nofollow">http://technet.microsoft.com/en-us/library/aa996205%28EXCHG.65%29.aspx</a> or here: <a href="http://msdn.microsoft.com/en-us/library/aa746475%28v=vs.85%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/aa746475%28v=vs.85%29.aspx</a></p> <p>Maybe I could try to filter users where (!CN=Computers) in DN, but first I'd like to filter (!objectclass=computer) as it is more logical for me.</p> <p>What is the correct syntax for <em>objectclass != "computer"</em> expression?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload