[FRPythoneers] New to Python... need help RE: ADSI and Active Directory

Brian Jarrett bjarrett at garcoschools.org
Thu Mar 27 18:53:26 MST 2003


Specifically:  I need a function that will search all OUs in AD for a username to make sure it isn't used before it is assigned to a user being added.  We are using a first initial, last name schema for usernames.  I want this to be as automatic as possible so a school secretary can enter a students first and last name and graduation year, it would create a username that isn't already used and assign a password.  The secretary would be shown a page that says "John Smith has been assigned the username jsmith with an initial password of 45392.  They may change their password by going to <Some URL here>."

Overall, I've been trying to construct an ADSI moniker that includes provider "LDAP://dc=garcoschools,dc=org", filter "objectClass=User", and base "SubTree", but I've not been able to do it.  Once I've figured out how to conduct searches (on saMAccountName, for instance) then I'll be able to do most of what I want.

So far, I've been able to build Python scripts that enable me to browse the AD tree, but I need the search capability next.  After that I'll be working on adding objects (specifically users) with and without Exchange 2000 mailboxes.

I guess I'm having a hard time understanding how I'm supposed to use the IADsUser interface that is included with ActiveState Python supposedly (what do I import?), I've also tried Makepy with the Active DS Type Library...  Just what is the best way to hook into ADSI with python?

As you can tell, I'm really just starting out on Python.  I've seen examples like the ADSI/Exchange script on ActiveState, but I can't seem to get some of the com hooks to work right.  (Getting "invalid moniker" errors or problems creating objects).

Brian


-----Original Message-----
From:	Erick Bodine [mailto:erick at allocity.com]
Sent:	Thu 3/27/2003 5:37 PM
To:	frpythoneers at lists.community.tummy.com
Cc:	
Subject:	RE: [FRPythoneers] New to Python... need help RE: ADSI and Active Directory
I actually am currently doing some AD interaction to pull E2k server
names, add 'Organizational Units' and users.  What are you trying to
search for??

--ERick

-----Original Message-----
From: Brian Jarrett [mailto:bjarrett at garcoschools.org] 
Sent: Thursday, March 27, 2003 5:34 PM
To: frpythoneers at lists.community.tummy.com
Subject: [FRPythoneers] New to Python... need help RE: ADSI and Active
Directory

I realize that most of you may be using Python on Linux, and I'd like to
keep it there, but I just can't.  I've decided to use Python because of
its platform independence and I want to learn a language that I can use
on Windows, Linux and even OS X.

My current project is to build a user-friendly website that allows
school secretaries to enter information about a new student and have it
create a user account for them in Active Directory.  It'll also need to
allow some employees to reset student user accounts.
After that I'd like to add pages that allow any user on the school
district's network to change their own password.

The environment is almost 50/50 Windows and Mac, and I'm introducing
some Linux in for advanced systems.  For now, Active Directory is my
LDAP provider and I have my Mac OS X server authenticating from it.

If there is anyone that has specific experience using Python to manage
Active Directory objects (particularly doing searches) I'd really like
to get some assistance from you.

Thanks,
Brian
_______________________________________________
This message sent by the FRPythoneers mailing list.
Unsubscribe: echo unsubscribe |
FRPythoneers-request at lists.community.tummy.com
URL: http://lists.community.tummy.com/mailman/listinfo/frpythoneers
_______________________________________________
This message sent by the FRPythoneers mailing list.
Unsubscribe: echo unsubscribe | FRPythoneers-request at lists.community.tummy.com
URL: http://lists.community.tummy.com/mailman/listinfo/frpythoneers



-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 4644 bytes
Desc: not available
URL: <http://lists.community.tummy.com/pipermail/frpythoneers/attachments/20030327/4a9945d1/attachment.bin>


More information about the FRPythoneers mailing list