簡體   English   中英

從 LDAP 查詢中沒有得到任何結果

[英]Get no result from LDAP query

我正在嘗試通過 LDAP 從特定 OU 中過濾掉員工。 問題是 OU 包含空格。 就其本身而言,在各個單詞之間有 \20,這個 OU 應該被解析並且能夠被找到。 此外,相應的 OU 中沒有 CN。

到目前為止,我已經嘗試過以下內容:

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

不幸的是,我只得到一個空的 output。

缺少搜索庫,我不知道如何在 ldap 查詢中實現它。

使用 Powershell 我沒有任何問題可以得到我想要的:

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

我很感激任何建議:)

提前致謝

您沒有提供足夠的信息來做出准確的評估。

您在 OU=Test,User,Accounts,DC=Lab,DC=local 中尋找什么?

但是,在 Microsoft Active Directory 中,無法構建單個 LDAP 查詢來過濾 OU 中的下屬。 並且 memberOf 不是與“組”不同的組織單元的屬性。

要在 OU 中搜索用戶,請將查詢的搜索根(有時稱為 Base DN)設置為 OU。 它不能在過濾器中完成。

memberOf屬性用於組,而不是 OU。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM