Connect to AD domain with authentication using Python


I'm using Python to write a simple client to Move users, Reset password, Extend user account using Tim Golden's active_directory module.

Currently I'm using the module with the default domain that I logged in with, and it works perfectly. But now I can't find any way to connect to another domain using the same module, when I use active_directory.AD("DC_name") it simply returns "pywintypes.com_error: (-2147463168, 'OLE error 0x80005000', None, None)"

I guess this have to do with authentication, because we have to do it when we access our AD (using ADExplorer). Can I do this with active_directory module, or with win32com API in general.

I know another python-ldap module that did it beautifully, but it can't move user from one OU to another. Any submission to use another module that does the job are welcome :)


asked on Stack Overflow Oct 9, 2012 by ntcong

1 Answer


It seems that active_directory is using default Win32 API, which doesn't support user/pass binding to a different DC.

You may have to use ldap module and find a workaround

answered on Stack Overflow Jan 16, 2013 by ntcong

User contributions licensed under CC BY-SA 3.0