ldap3 icon indicating copy to clipboard operation
ldap3 copied to clipboard

No objects found within the specified OU

Open valnurat opened this issue 1 year ago • 2 comments

Hi. I'm trying to collect objects in our Active Directory, but I'm getting the same error all the time no matter what. "No objects found within the specified OU."

I have tried to change the ou_path, but no luck. So I wounder if what I have done, is the right approach?

My code is this: from ldap3 import Server, Connection, SUBTREE

server_uri = 'ldap://ad.company.org' ou_path = 'OU=Users,OU=SO,OU=DK,OU=Company,DC=ad,DC=company,DC=org' ldap_query = f'(objectClass=*)' server = Server(server_uri) conn = Connection(server) conn.bind()

conn.search(search_base=ou_path, search_filter=ldap_query, search_scope=SUBTREE)

if conn.entries: for entry in conn.entries: print(entry.entry_dn) else: print("No objects found within the specified OU.") conn.unbind()

valnurat avatar Feb 21 '24 13:02 valnurat

Did you solve this? It seems that you do not have permission to read the objects.

cannatag avatar Mar 19 '24 22:03 cannatag

I have this same issue. There are times I am searching for an email and ldap3 returns no entries but the email exists in AD. I ran a loop a hundred times to search for an email and got inconsistent results. 5 out of 100 returned zero entries.

sam-cha-tfs avatar Jul 01 '24 23:07 sam-cha-tfs