Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer

up vote 2 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:

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

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.