pyad icon indicating copy to clipboard operation
pyad copied to clipboard

from_cn returns multiple results

Open dshepherd21 opened this issue 8 years ago • 0 comments

I have cross forest trust in place and am using from_cn to return a handle on an individual domains administrator.

The following line of code...

adhandle=aduser.ADUser.from_cn(user,options=dict(ldap_server=dns))

Gives an exception when the user var is set to administrator and states ...

Traceback (most recent call last): File "", line 1001, in File "", line 796, in connect File "C:\nwscript\build\nwscipt\out00-PYZ.pyz\pyad.adobject", line 132, in fro m_cn File "C:\nwscript\build\nwscipt\out00-PYZ.pyz\pyad.adsearch", line 17, in by_c n File "C:\nwscript\build\nwscipt\out00-PYZ.pyz\pyad.adquery", line 73, in get_s ingle_result pyad.pyadexceptions.invalidResults: The specified query resturned 3 results. get SingleResults only functions with a single result.

By default how can an AD query for CN return multiple results, and if it is due to the cross forest trust how can you scope the query ?

Any thoughts ?

dshepherd21 avatar Apr 11 '16 20:04 dshepherd21