User Creation “Event” to run a Script

active-directorywindows-server-2008-r2

Is there something like an "event" that is fired when a user is created in active directory? An external system automatically creates active directory users and I would like to perform some powershell tasks directly after creation of a new user. When the user logs on, the script should have run already.

Has someone an idea how this could be achieved?

I am running Windows Server 2008 R2.

Best Answer

You have a couple of problems:

  1. I can probably come up with an event to fire on a DC when a users is created but how can you guarantee that users will only be created on 1 DC?
  2. User accounts are users accounts, so how will you determine what acounts are created by this external process and which were created for other reasons (service accounts etc.)?

Your best bet is to have the scripts kicked off by the external system. In the past instead of allowing some external system access to create users I have the external system kick off a script to create users and pass the details as parameters.

Related Topic