Discussion Locked

Help with LDAP query

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hello there,

Anybody have an idea how to run an LDAP query to return all enabled users??
I was able to find one for disabled users which is:
(&(objectCategory=Person)(objectClass=user)(userAccountControl:1.2.840.113556.1.4.803:=2))

but how do you change it for enabled users???

Thanks in advance..
E Canaan

5 replies

by lester.rivera

The LDAP query to return all enabled users is:
(&(objectCategory=person)(objectClass=user)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))

It essentially says to return all users that are NOT disabled.

Hope this helps...

-Les
----------------------------------
lester.rivera@plangear.com
Plangear is the premier provider of LDAPxl, a directory services (LDAP) search add-in for Microsoft Office. Check out http://www.plangear.com/ldapxl/

by skumar2

(&(objectCategory=Person)(objectClass=user)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))

by bukie33613

To list enabled user is very easy. All you have to do is take "NOT" the disabled clause of the search filter. That is, you do as such:
(&(objectCategory=Person)(objectClass=user)(!userAccountControl:1.2.840.113556.1.4.803:=2))

That should now list all enabled users.

by lordplatypus

Just put a ! in front of the query for not:

(!(userAccountControl:1.2.840.113556.1.4.803:=2))

So now its a search for users not disabled.

by jtvanderb

(&(objectCategory=Person)(objectClass=user)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))

This discussion is closed to new replies.