Tech Off Thread

2 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Passing argument to script in Task Scheduler

Back to Forum: Tech Off
  • User profile image

    Hi all,

    I'm experiencing a problem with trying to capture an event within Windows Server 2008 R2. Well, capturing the event is OK and then performing an action is OK but I'm having problems with passing an argument to a script.

    Essentially then the event I'm catching is user creation in Active Directory and I'm then invoking a vbscript and passing an argument to the vbscript - the argument being the username of the newly created user. I have the following in the custom event filter:


      <Query Id="0" Path="Security">
        <Select Path="Security">*[System[(EventID=4722)] and EventData[(Data[@Name="TargetUserName"])]]</Select>


    and I also have "TargetUserName" defined in the 'Add arguments' textbox control in the actions tab.

    I think I'm being a numpty here. The script does run when a new user is created but no argument is passed to the script. (Incidentally this script is a vbscript and if I manually run the script from the command line and pass an argument to it then all runs fine so it's not the script - it's something I'm doing - or rather not doing - in the Task Scheduler.)


    Thanks for reading and any help would be very much appreciated.



  • User profile image

    *SNAP* (but I'm not up to the script part yet - just doing a message box to see if it was even possible).  Came across this by Benno Zelders which helped me out and is probably relevant to you and anyone else trying the same:



Conversation locked

This conversation has been locked by the site admins. No new comments can be made.