zakird / pyad

Python Active Directory Tools | *Not actively maintained*
http://zakird.github.io/pyad/
176 stars 72 forks source link

Unable to detect default domain. Must specify search base. #79

Open itwolfsolutions opened 6 years ago

itwolfsolutions commented 6 years ago

I'm trying to implement a basic example as specified here: https://zakird.com/pyad/pyad.html from pyad import aduser user = aduser.ADUser.from_cn("myuser") But i got the following error message:

File "C:\Python27\lib\site-packages\flask\app.py", line 1997, in call return self.wsgi_app(environ, start_response) File "C:\Python27\lib\site-packages\flask\app.py", line 1985, in wsgi_app response = self.handle_exception(e) File "C:\Python27\lib\site-packages\flask\app.py", line 1540, in handle_exception reraise(exc_type, exc_value, tb) File "C:\Python27\lib\site-packages\flask\app.py", line 1982, in wsgi_app response = self.full_dispatch_request() File "C:\Python27\lib\site-packages\flask\app.py", line 1614, in full_dispatch_request rv = self.handle_user_exception(e) File "C:\Python27\lib\site-packages\flask\app.py", line 1517, in handle_user_exception reraise(exc_type, exc_value, tb) File "C:\Python27\lib\site-packages\flask\app.py", line 1612, in full_dispatch_request rv = self.dispatch_request() File "C:\Python27\lib\site-packages\flask\app.py", line 1598, in dispatch_request return self.view_functionsrule.endpoint File "C:\Python27\lib\site-packages\flask_login\utils.py", line 261, in decorated_view return func(*args, **kwargs) File "C:\Inetpub\vhosts\datastreetpartners.com\httpdocs\avenue\app\sites\routes.py", line 913, in ad user = aduser.ADUser.from_cn("myuser") File "C:\Python27\lib\site-packages\pyad\adobject.py", line 135, in from_cn return cls(adsearch.by_cn(cn, search_base, options), None, options) File "C:\Python27\lib\site-packages\pyad\adsearch.py", line 10, in by_cn raise Exception("Unable to detect default domain. Must specify search base.") Exception: Unable to detect default domain. Must specify search base.

stevenpitts commented 5 years ago

Hey there, Is your machine bound to a domain, or are you on a workgroup?

LochyWragg commented 5 years ago

Hey there, Is your machine bound to a domain, or are you on a workgroup?

Having same error. Am currently on VPN on personal machine, trying to use pyad_setdefaults without success so far.

gillib commented 4 years ago

Hi Was this ever solved?

I have this issue but it is inconsistent. I have a system running, and approximately once every couple of weeks I get this error and it is not solved until I restart the service (or in other words (as I understand this), kill all pyad objects, re-import the modules and recreate the objects)

I am running version 0.5.20