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.
You have a couple of problems:
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.
Yes. These are event IDs 4722,4738,etc. in your Security event log. The event text will contain the string "A user account was enabled." or "A user account was changed," respectively. The event for "A user account was created" is event 4720.
And it is true that not every domain controller will log all the user creation events if the user is created on a different DC. If that's a concern for you, consider a more thorough approach to AD event auditing as detailed here:
http://technet.microsoft.com/en-us/library/cc731607(WS.10).aspx
After that, it would be a simple matter of using Powershell Cmdlets such as Get-Eventlog to find these events and do things based on them.