Search code examples
active-directoryldap

Active Directory: Search for only user objects


I'm using the search filter "(objectClass=user)" to find user objects, but of course it also returns computers because a computer also has user in its objectClass. How can I create a filter to only return objects users and not objects whos type inherits from user?


Solution

  • (&(objectClass=user)(objectCategory=person))
    

    (via Microsoft Learn)