pyad icon indicating copy to clipboard operation
pyad copied to clipboard

Can you use pyad.set_defaults with adquery.ADQuery()? If not, what is the correct way to query Active Directory remotely?

Open naloqab opened this issue 6 years ago • 4 comments

This is what I get:

Traceback (most recent call last): File ".\ldap_test2.py", line 7, in q = adquery.ADQuery() File "C:\Program Files (x86)\Python\Python36-32\lib\site-packages\pyad\adquery.py", line 39, in init self.__adodb_conn.Open("Provider=ADSDSOObject") File "<COMObject ADODB.Connection>", line 3, in Open File "C:\Program Files (x86)\Python\Python36-32\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, 'Microsoft OLE DB Service Components', 'The parameter is incorrect.', None, 0, -2147024809), None)

naloqab avatar May 11 '18 14:05 naloqab

having this issue myself

daveoy avatar May 16 '18 23:05 daveoy

Try as following (via [ https://zakird.com/pyad/pyad.html ])

from pyad import *
pyad.set_defaults(ldap_server="dc1.domain.com", username="service_account", password="mypassword")
user = pyad.aduser.ADUser.from_cn("myuser"
```)

gorkemgoknar avatar Nov 26 '18 09:11 gorkemgoknar

ADQuery object, not ADUser object.

daveoy avatar Nov 26 '18 13:11 daveoy

There is the fix https://github.com/zakird/pyad/issues/49 , you should replace in adquery.py new version does not implement it (maintanence stopped)

gorkemgoknar avatar Nov 27 '18 07:11 gorkemgoknar