General discussion

Locked

Help with LDAP query

By e_canaan ·
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

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by lester.rivera In reply to Help with LDAP query

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/

Collapse -

Search Enabled Users in AD

by skumar2 In reply to Help with LDAP query

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

Collapse -

RE: Help with LDAP query

by bukie33613 In reply to Help with LDAP query

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.

Collapse -

by lordplatypus In reply to Help with LDAP query

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.

Collapse -

by jtvanderb In reply to Help with LDAP query

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

Back to Networks Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums