Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to run a scheduled task every time after a given service is started. I have looked for a way to set a trigger on a service start, so that the service in question may be started automatically at system start or manual restarted on run time.

The System it should work on is a Windows Server 2008 R2.

Detailed description:

  • On server A an UMS service is running
  • On server B a FAX line service is running and connects to the UMS service on server A
  • If server A or the UMS service on it is restarted the FAX service on server b is loosing its connection and has to be restarted.

So, I want to schedule a script on server A with the start of the UMS service and restart the FAX Line service on server B via net stop/start from that.

The missing point is, how would I define the trigger for the task scheduler?

share|improve this question
up vote 6 down vote accepted

You can do this using Task Scheduler with a Trigger set up as follows:

Begin the task: On an event

Settings: Custom

Click the New Event Filter... button

Select the XML tab

Check the Edit query manually checkbox

Click the Yes button

Enter the following in the text box, replacing your service name:

   <Query Id="0"> 
      <Select Path="System"> 
         *[EventData[Data[@Name='param1'] and (Data='YOUR SERVICE NAME')]] 
         *[EventData[Data[@Name='param2'] and (Data='running')]] 

More information on XML Event filtering here: Advanced XML filtering in the Windows Event Viewer.

Note: When using a non English Windows 'Data' for 'param2' depends on the system's language. E.g. for a German version of Windows it is 'Ausgeführt' instead of 'running'.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .