Subscribe to a local or remote TaskService?

Sep 21, 2014 at 4:57 PM
Edited Sep 21, 2014 at 5:02 PM
Hi all!

First of all, I LOVE THIS CODE - it is saving my life in terms of being able to run programs on remote PCs using different credentials! :)

** Here's my question: is there a way to subscribe to a local or remote TaskService so that I get notifications when any TaskScheduler change occurs?

I'm currently showing all tasks in a DatGridView, and instead of a user needing to refresh the list, I would like to be able to do this only when my program gets notification of a change...

Any thoughts or ideas about this?

(and thanks in advance)! :)

*** After thinking about this more, maybe what I'm after is some kind of HOOK I can created that would let me know when TaskScheduler events or mothods are bing used\accessed?
Sep 22, 2014 at 4:31 PM
The only thing that would indicate a task has run is the event log on the computer running the task. You could actually create another task that runs an executable or COM server that fires when a completion event is posted for the task you are wanting to get a notification from. You would use an EventTrigger and set the subscription value to the following (replacing the name of the task reference with your's):
  <Query Id="0" Path="Microsoft-Windows-TaskScheduler/Operational">
    <Select Path="Microsoft-Windows-TaskScheduler/Operational">
            and (Level=4)
            and (EventID=201)
            ]='\Full task path of task to track'