Consider looking at the win32comext\adsi\demos directory - search.py has an example. This module exposes the ADSI interfaces "natively", rather than using IDispatch object.
Mark > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of Gooch, John > Sent: Friday, 9 December 2005 4:22 AM > To: python-win32@python.org > Subject: [python-win32] ADSI and LDAP Searches > > > I am trying to get my Python script to search Active Directory for users > with a certain login name and then have it return their adspath > attribute. Previously, I had a working script that used Tim Golden's > active_directory module, but since the more recent round of NT Server > patches, it no longer works, so now I am trying to make a work around to > this issue. > > Here is what I have that is working ( in my test script ): > > ________________________________ > import win32com.client > username = "John.Gooch" > > > adsi = win32com.client.Dispatch('ADsNameSpaces') > ldap = adsi.getobject('','LDAP:') > DSO = ldap.OpenDSObject( "LDAP://MER2-ECHDC2.echostar.com","","", 1) > _________________________________ > > It works up to here, so now I assume I am connected to Active Direcory > and can now run an LDAP-style search: > _________________________________ > DSO.execute("<LDAP://ou=echostar,ou=com>;(cn=*);adspath;top") > _________________________________ > > Ok,no go on that line( throws error "AttributeError: <unknown>.execute" > , but then I am complete guessing the syntax based upon an old Perl > script I had that used to do this job. > > > Does anyone have a working example of searching Active Directory? Of you > course you can put in made up domain/server names where necessary. > > Thank You, > > > John A. Gooch > Systems Administrator > IT - Tools > EchoStar Satellite L.L.C. > 9601 S. Meridian Blvd. > Englewood, CO 80112 > Desk: 720-514-5708 > > > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32