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:
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:
Code:
from ldap3 import Server, Connection, SUBTREEserver_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()
Statistics: Posted by valnurat — Wed Feb 21, 2024 11:46 am