Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating LDAP accounts from a SQL trigger

Status
Not open for further replies.

johnjrd

MIS
Jun 6, 2001
54
GB
Ive been reading about creating LDAP accounts automatically using batch files. However we have a need to automatically trigger the creation of a LDAP account into Active Directory when a record is inserted into a sql table. Is it possible to do this is one action? , rather than creating a batch csv file and then using the bulk import tool into LDAP.

Any ideas would be welcome

 
Write a CLR stored procedure that calls the LDAP object and creates accounts based on DB info. Call this SP with your trigger.

I have a bunch of code that's not with me right now, but you can get some ideas from


Good luck!

Phil H.
Some Bank
-----------
Time's fun when you're having flies.
 
It sounds too dangerous to me. What if you need to import some historical data for a one-off process? You better remember to disable your trigger or you'll end up with a bunch of bogus AD accounts.

I would advise against doing this altogether. While it might sound neat being able to do this, SQL Server is really just a database platform, and not a network/workgroup manager. It's kind of like hiring a roofer and then asking him to mow your lawn. While he can probably perform the task, it's not the best use of his time and expertise. I would code this as part of the process in your application which inserts the records. You can even declare a SQL transaction to rollback if your application fails to correctly create the account.
 
True, RG. My app had the functions in business logic, not the DB. Triggers bad.

Phil H.
Some Bank
-----------
Time's fun when you're having flies.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top