简体   繁体   中英

Get no result from LDAP query

I am trying to filter out employees from a specific OU via LDAP. The problem is that the OU contains spaces. By itself, with \20 between the respective words, this OU should be resolved and be able to be found. Furthermore, there is no CN in the respective OU.

What I have tried so far is the following:

(&(objectCategory=person)(objectClass=user)(ou=test\20user\20accounts,dc=lab,dc=local))

Unfortunately I only get an empty output.

The searchbase is missing and i dont know how to implement it in the ldap query.

With Powershell i dont have any issues to get what i want:

Get-ADObject -LDAPFilter "(ObjectClass=user)"  -SearchBase "ou=test\20user\20accounts,dc=lab,dc=local" -Properties *  |`
? {$_.ObjectCategory -like "cn=Person*" }| select name,objectclass,ObjectCategory | fl

I appreciate any advice:)

Thanks in advance

You do not supply enough information to make an accurate assessment.

What are you looking for within OU=Test,User,Accounts,DC=Lab,DC=local?

But, In Microsoft Active Directory there is no ability to construct a single LDAP query to filter subordinates within an OU. and memberOf is not a property of an organizationalUnit which is different than a "group".

To search for users in an OU, set the search root of your query (sometimes called Base DN) to the OU. It cannot be done in the filter.

The memberOf attribute is used for groups, not OU's.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM