通过ADO访问Active Directory [英] Seaching Active Directory via ADO

查看:59
本文介绍了通过ADO访问Active Directory的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法找到使用ADO搜索的简单工作示例

Active Directory。我希望有人可以指点我一个通用的工作

脚本连接到AD并拉出一个记录集来帮助我开始

学习ADO的正确方向,关于Python的ADSI。

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.

推荐答案

Heya,


有几个关于O''的例子赖利网站。这两个是从''Active Directory Cookbook'获取的,第一个使用COM对象

而第二个使用本机LDAP模块:

http://www.rallenhome。 com / books / adco ... hon_com.py.txt
http://www.rallenhome.com/books/adco...on_ldap.py.txt


给你一个开始。


- alex23

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/adco...hon_com.py.txt
http://www.rallenhome.com/books/adco...on_ldap.py.txt

This might give you a start.

- alex23


谢谢,但我看的ADO com对象比ADSI更多或ldap。

由于一些奇怪的原因,很难找到任何工作脚本

使用ADO连接和搜索AD。连接到AD时是否存在ADO和python

的问题?

我试图自己构建一个没有运气。我想我的问题是

adodb.command来电。


感谢您的回复。


" alex23" <吴***** @ gmail.com>在消息中写道

news:11 ********************* @ f14g2000cwb.googlegro ups.com ...
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 problem is with
adodb.command calls.

Thanks for your response.

"alex23" <wu*****@gmail.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
Heya,

O''Reilly网站上有几个例子。这两个来自''Active Directory Cookbook'',第一个使用COM对象
而第二个使用本机LDAP模块:

http://www.rallenhome.com/books/adco ... thon_com.py.tx

t
http://www.rallenhome.com/books/adco...thon_ldap.py.t

xt
这个可能会给你一个开始。

- alex23
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/adco...thon_com.py.tx
t http://www.rallenhome.com/books/adco...thon_ldap.py.t
xt
This might give you a start.

- alex23



这是一个使用ADO搜索
用户通过通配符。


import win32com.client

c = win32com.client.Dispatch(" ADODB.Connection")

c.Open(" Provider = ADSDSOObject")

rs,rc = c.Execute("""

SELECT adspath,title,name

来自''LDAP:// DC = yourdomain,DC = COM''

其中objectClass =''user''和name =''Roger *''

""")


而不是rs.EOF:

for f in rs.Fields:

print f .Name,f.Value

rs.MoveNext()


hth

Roger


LittlePython <黎********** @ lost.com>在消息中写道

news:56aJf.78250
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=''Roger*''
""")

while not rs.EOF:
for f in rs.Fields:
print f.Name, f.Value
rs.MoveNext()

hth
Roger

"LittlePython" <Li**********@lost.com> wrote in message
news:56aJf.78250


这篇关于通过ADO访问Active Directory的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆