For some background information: we're a Windows environment using server 2008 with AD for desktop auth. We are an online retail business; our online presence and our intranet are *nix based.

When we have a new user, I want to be able to simply create that user within Active Directory and then have that go off and create matching user accounts in our intranet system.

Is there some Active Directory hooks I can use to run a simple python script when I create a new user?

  • 1
    why don't you have your intranet server join the AD domain? It is not very complicated nowadays and that way you will have just one source for the authorization. Test it in a test machine first though (do not play on production servers :-) ) – natxo asenjo Oct 4 '10 at 12:22

I don't believe there are any accessible hooks for new user creation in AD. You could do a script to poll for users, keep track of the existing ones, and then provision any new users. I think that's about as good as you're going to get. The other option is to provision your AD users with Python from your intranet side. Creating AD users is fairly easily scriptable. Or like Natxo said, just change your intranet system to authenticate on AD. I'm sure there are a lot of politics so I will assume that is not an option.


Short Answer: You can't get there from here.

Longer Answer: There is no hook for "on account creation". You would have to wrap your user-creation into a script/process that also executes this python script after the account creation. Or, You can change your user-account-creation so that it is done from within a python script (or add those steps to your existing python script.)

There is another option, however. You could set up a schtask/cron that runs periodically that searches AD/LDAP for all users who have been created since the last time that it ran. (If you have it run every 30 minutes, you'd look for users with a creation date expressed as (now - 30 min.))

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy