user3377627
user3377627

Reputation: 387

Need help querying LDAP with the internal contents of the DN

In AD, I have the following User DNs:

CN=Some Guy,OU=Users,OU=Ohio,DC=company,DC=net
CN=Some Lady,OU=Users,OU=Jamaica,DC=company,DC=net

How can I do a query in LDAP that can retrieve both users, using the DN and wildcards?

I been trying the following string:

(&(dn=*Users*))

That gives me nothing. I try extensible search:

(&(dn:ou:=Users))

But that returns:

OU=Users,OU=Ohio,DC=company,DC=net
OU=Users,OU=Jamaica,DC=company,DC=net

I have several locations I need to search and I want to find what each location has under their Users OU.

Upvotes: 0

Views: 41

Answers (1)

Esteban
Esteban

Reputation: 1815

The extensible search is not the correct one.

Use instead :

(&(objectClass=user)(ou:dn:=Users))

It should select every entry with objectClass=user and which the dn contains ou=Users

Upvotes: 1

Related Questions