from pyad import *
pyad.set_defaults(ldap_server="Anonymized_Server", username="Anonymized_Logon", password="Anonymized_Password")
user = pyad.aduser.ADUser.from_cn("Anonymized_User")
leads to this error:
Traceback (most recent call last):
File "d:/Coding/Python/ad-tool/ad-tool.py", line 4, in
user = pyad.aduser.ADUser.from_cn("Anonymized_User")
File "C:\ProgramData\Anaconda3\lib\site-packages\pyad\adobject.py", line 135, in from_cn
return cls(adsearch.by_cn(cn, search_base, options), None, options)
File "C:\ProgramData\Anaconda3\lib\site-packages\pyad\adsearch.py", line 14, in by_cn
_ad_query_obj.execute_query(where_clause=("CN = '%s'" % cn),
File "C:\ProgramData\Anaconda3\lib\site-packages\pyad\adquery.py", line 78, in execute_query
self.rs, self.rc = command.Execute()
File "", line 2, in Execute
File "C:\ProgramData\Anaconda3\lib\site-packages\win32com\client\dynamic.py", line 287, in ApplyTypes
result = self.oleobj.InvokeTypes(*(dispid, LCID, wFlags, retType, argTypes) + args)
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, 'Active Directory', 'An operations error occurred.\r\n', None, 0, -2147217865), None)
On the server side I can see in the event log, that the user, trying to authenticate is not Anonymized_Logon. It's the User, that is logged in on the code executing device, with domain information from the executing device. As if the code is ignoring the set defaults.
This Code:
leads to this error:
On the server side I can see in the event log, that the user, trying to authenticate is not Anonymized_Logon. It's the User, that is logged in on the code executing device, with domain information from the executing device. As if the code is ignoring the set defaults.