Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No objects found within the specified OU #1126

Open
valnurat opened this issue Feb 21, 2024 · 2 comments
Open

No objects found within the specified OU #1126

valnurat opened this issue Feb 21, 2024 · 2 comments

Comments

@valnurat
Copy link

valnurat commented Feb 21, 2024

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()

@cannatag
Copy link
Owner

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

@sam-cha-tfs
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants