With help I have been able to put together a little example. It illustrates
several different ways..
import win32com.client
c = win32com.client.Dispatch("ADODB.Connection")
c.Open("Provider=ADSDSOObject")
##Check if connected to AD
if bool(c.state): print "Connected to AD"
## This uses sql dia
You could also use the excellent active_directory module of Tim Golden (http://tgolden.sc.sabren.com/python/active_directory.html)Your query would then become:
import active_directoryfor person in active_directory.search ("objectClass='user'","name='Roger*'"): print person.displayName
On 2/17/06,
Here's a short example that uses ADO to search for a
user by wildcard.
import win32com.client
c = win32com.client.Dispatch("ADODB.Connection")
c.Open("Provider=ADSDSOObject")
rs,rc=c.Execute("""
SELECT adspath, title, name
>From 'LDAP://DC=yourdomain, DC=COM'
where objectClass='user' and name='Ro
I notice there is no adodb.command. This is not required?
Thx for the example!
"Roger Upole" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Here's a short example that uses ADO to search for a
> user by wildcard.
>
> import win32com.client
> c = win32com.client.Dispatch("ADODB.Connec
Thanks but I was looking more for ADO com object than ADSI or ldap.
For some strange reason it is very hard to locate any working scripts that
use ADO to connect and search AD. Is there an issue with ADO and python
when connecting to AD?
I have try to build one myself with no luck. I think my prob
Heya,
There are a couple of examples on the O'Reilly site. These two are
taken from 'Active Directory Cookbook', the first uses a COM object
while the second uses a native LDAP module:
http://www.rallenhome.com/books/adcookbook/src/18.6-rootdse_python_com.py.txt
http://www.rallenhome.com/books/ad
It usually means the domain you specified can't be found.
Roger
"LittlePython" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Do you know what this may mean?
>
> C:\Documents and Settings\Administrator\Desktop\pytest>ADOSeach.py
> Traceback (most recent call last):
> F
To be more clear, something like this example but in python. I have tryed to
convert something very simular to this
but have failed.
-- SCRIPT CONFIGURATION --
strBase= ">;"
strFilter = ";"
strAttrs = ";"
strScope = ""
' -- END CONFIGURATION -
set objConn = CreateOb
Never mind , I know what's wrong ... need to use the right account. It works
great and is a great example .. thx
"LittlePython" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Do you know what this may mean?
>
> C:\Documents and Settings\Administrator\Desktop\pytest>ADOSeach.py
> Tr
Do you know what this may mean?
C:\Documents and Settings\Administrator\Desktop\pytest>ADOSeach.py
Traceback (most recent call last):
File "C:\Documents and Settings\Administrator\Desktop\pytest\ADOSeach.py",
lin
e 6, in ?
rs,rc=c.Execute("""
File "", line 3, in Execute
File "C:\Python24
You could also accomplish the same thing using the
Command object, but this way is usually more concise
for plain Sql.
Roger
"LittlePython" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I notice there is no adodb.command. This is not required?
> Thx for the example!
> "Ro
I am have trouble finding a simple working example of using ADO to search
Active Directory. I am hoping someone could point me to a generic working
script that connects to AD and pulls up a recordset to help me get started
into the right direction in learning ADO, ADSI on Python.
--
http://mail
12 matches
Mail list logo