Apr-26-2018, 05:06 PM
I'm trying to figure out how to put in a variable in my search string for ldap3. I want to create a loop that goes through a list of usernames and does an Active Directory search thru each username.
First statement binds me to Domain Controller, the second one does a search. I'm trying to have a variable at the end of the second statement for the sAMAccountName. I want "adname" to be my variable. How do I do that?
First statement binds me to Domain Controller, the second one does a search. I'm trying to have a variable at the end of the second statement for the sAMAccountName. I want "adname" to be my variable. How do I do that?
conn = Connection([server1], user='domain\\user', password='password', auto_bind=True) conn.search('dc=test,dc=mydomain,dc=com', '(&(objectCategory=person)(objectClass=user)(sAMAccountName=adname))')Thanks in advance.