Can someone help me to solve my issue? I try to download some user-info from server's active directory. When I tried that without pyad_setdefaults - that's ok. But when I try to connect to another server -I have an error.
import pyad
import pyad.adquery
pyad.pyad_setdefaults(ldap_server= 'myserv', username= 'login', password= 'pass'
q = pyad.adquery.ADQuery()
attributes = ['SamAccountName']
q.execut_equery(attributes= attributes)
result= q.get_all_results()
I tried pyad.pyad.set_defaults - there were the same error. My server has a connection to another. And this account has an acces to AD.
I figured out. If you want to use adquery , you need to set default server:
Sometimes you need to indicate base_dn in execute_query.