Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8080589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:27:25+00:00 2026-06-05T16:27:25+00:00

Scenarios I need to solve with task scheduler in Windows Server 2008: (#1) task

  • 0

Scenarios I need to solve with task scheduler in Windows Server 2008:

(#1) task A tries to run a program > task A succeeds and runs the exe file > task B looks at events of task A and emails recipients that task A ran successfully.

Events of scenario #1 (notice group of times in screen shot for reference):

100-Task Started
319-Task Engine received message to start task
110-Task triggered by user
200-Action started
129-Created Task Process
201-Action completed
102-Task completed

(#2) task A tries to run a program > task A fails to run the exe file because exe file doesn’t exist > task B looks at events of task A and emails recipients about failure.

Events of scenario #2 (notice group of times in screen shot for reference):

319-Task engine received message to start task
110-Task triggered by user
100-Task Started
200-Action started
203-Action failed to start
103-Action start failed

enter image description here

Here are events of task A. Read them from top to bottom. I’ve re-written in correct order above.

Here is the XPath query for scenario #1 that works. I cannot figure out what XPath for scenario #2 (task that sends failure email).

<QueryList>
  <Query Id="0" Path="Microsoft-Windows-TaskScheduler/Operational">
    <Select Path="Microsoft-Windows-TaskScheduler/Operational">

*[System[EventID=201]] 
and *[EventData[Data[@Name='ResultCode']='0' 
or Data[@Name='ResultCode']='1']] 
and *[EventData[Data[@Name='TaskName']='\test_email_task']]

</Select>
  </Query>
</QueryList>

=================

Update 6/8/2012 @ 1:55

More specifically, scenario #1 doesn’t work. And scenario #2 does work. For scenario #1, I’m thinking the system is unable to trigger the event because of the ResultCode of 2147942402. This means Windows could not find the file.

Scenario #1:

... task2 doesn't send email
... task1 has EventID 103 and ResultCode 2147942402
... task1 has EventID 203 and ResultCode 2147942402
  • Create 2 tasks.
  • Call task #1 “task1_execute_program”; add an Action to open a program in “c:\windows\system32\bogus.exe” (invalid program)
  • Call task #2 “task2_send_email_based_on_result_of_task1”; add an Action to send an email … enter details and SMTP server …. then add a Trigger based on an event …. click XML tab and enter the XPath query below:

Scenario #2:

... task2 sends email because it found write.exe
... task1 has EventID 102-Task Completed
  • keep everything the same, but change the Action program in task #1 from “c:\windows\system32\bogus.exe” (invalid program)” to “c:\windows\system32\write.exe” (valid program)

=====================

<QueryList>
    <Query Id="0" Path="Microsoft-Windows-TaskScheduler/Operational">
        <Select Path="Microsoft-Windows-TaskScheduler/Operational">

        *[System[EventID=203] and 
        *[EventData[Data[@Name='TaskName']='\task1_execute_program']]]

        or

        *[System[EventID=102]] 
        and *[EventData[Data[@Name='TaskName']='\task1_execute_program']]

        </Select>
    </Query>
</QueryList>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T16:27:27+00:00Added an answer on June 5, 2026 at 4:27 pm

    Guess it’s not a bug. I used different attributes to solve it. Task vs. EventID. The columns in the event history don’t match the name in the XPath syntax. “EventID” does work (along with “Task”), but only when you don’t have the Result Code mentioned. So there could very well be a bug in Task Manager. But this is a good workaround.

    <QueryList>
      <Query Id="0" Path="Microsoft-Windows-TaskScheduler/Operational">
        <Select Path="Microsoft-Windows-TaskScheduler/Operational">
    
        *[
            System
            [
                Provider[@Name='Microsoft-Windows-TaskScheduler'] 
                and (Level=0 or Level=1 or Level=2 or Level=3 or Level=4 or Level=5) and (Task = 103 or Task = 203)
            ]       
            or
            System
            [
                Provider[@Name='Microsoft-Windows-TaskScheduler'] 
                and (Level=0 or Level=1 or Level=2 or Level=3 or Level=4 or Level=5) and (Task = 102)
            ]       
        ]
    
        and 
    
        *[
            EventData
            [
                Data
                [
                    @Name='TaskName'
                ]='\task1_execute_program'
            ]
        ]
    
        </Select>
      </Query>
    </QueryList>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a scenario where I need to run a certain task at specific
I need to solve a locking problem for this scenario: A multi CPU system.
In some scenarios I need a wide version of an entity with many properties
Working in .NET Compact Framework, C#, .Net 3.5, Visual Studio 2008. Targeting Windows Mobile
I am trying to to solve a problem where I need to pass large
There is a scenario that i need to solve with shared_ptr and weak_ptr smart
I have a data file and from time to time I need to write
Scenario : You need to expose the same app on different screens - let's
Here's my scenario: I need to make three or four calls to different WCF
I have a scenario where I need to do the following in a transaction:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.