Is there a way to search for a user with say "bob" anywhere in their first name or last name or even full name in pyad?
I know in c# we can write:
string nameSearch = "bob";
Filter = "(&(objectClass=User)(anr=" + nameSearch + "))"
but how would we do this for pyad? I have:
import pyad.adquery, pyad.aduser
username = "bob"
q = pyad.adquery.ADQuery()
q.execute_query(
attributes = ["givenName", "sn", "mail", "title", "l", "c", "manager"],
where_clause = "givenName = '{}'".format(username),
base_dn = "DC=company,DC=com"
)
for row in q.get_results():
print (row["givenName"] + " " + row["sn"])
But this only finds anyone with the name Bob as their given name.
Figured it out (rather sheepishly):