Skip to content

Codepolice

  • ⤫

Send E-Mail When a task in Task Scheduler Fails

Posted by Judy Alvarez Posted on February 28, 2022March 1, 2022
0

You would guess that this would be a really easy task but it turns out this was pretty complicated. Basically, you need to create a scheduled task that gets triggered by an event and do some editing of that task in a notepad. I will just post my exported task here. Feel free to use it / modify it as you want.
<?xml version=”1.0″ encoding=”UTF-16″?>
<Task version=”1.2″ xmlns=”http://schemas.microsoft.com/windows/2004/02/mit/task”>
<RegistrationInfo>
<Date>2012-09-07T09:36:00.5466938</Date>
<Author>Administrator</Author>
</RegistrationInfo>
<Triggers>
<EventTrigger>
<Enabled>true</Enabled>
<Subscription>&lt;QueryList&gt;&lt;Query Id=”0″ Path=”Microsoft-Windows-TaskScheduler/Operational”&gt;&lt;Select Path=”Microsoft-Windows-TaskScheduler/Operational”&gt;*[System[(EventID=201)]] and *[EventData[(Data[@Name=”ResultCode”]!=0)]]&lt;/Select&gt;&lt;/Query&gt;&lt;/QueryList&gt;</Subscription>
<ValueQueries>
<Value name=”custom”>Event/EventData/Data[@Name=’TaskName’]</Value>
<Value name=”eventChannel”>Event/System/Channel</Value>
<Value name=”eventRecordID”>Event/System/EventRecordID</Value>
<Value name=”eventSeverity”>Event/System/Level</Value>
</ValueQueries>
</EventTrigger>
</Triggers>
<Principals>
<Principal id=”Author”>
<UserId>Administrator</UserId>
<LogonType>Password</LogonType>
<RunLevel>LeastPrivilege</RunLevel>
</Principal>
</Principals>
<Settings>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>false</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>P3D</ExecutionTimeLimit>
<Priority>7</Priority>
</Settings>
<Actions Context=”Author”>
<SendEmail>
<Server>localhost</Server>
<Subject>Event $(eventRecordID) – $(custom) – $(eventChannel)</Subject>
<To>[email protected]</To>
<From>[email protected]</From>
<Body>Yo!</Body>
<HeaderFields />
<Attachments />
</SendEmail>
</Actions>
</Task>
Just save it as an XML file and import it into the Task Scheduler.

Categories: JavascriptTagged: asp dot net interview questions, asp dot net tutorial, asp net core 3, asp net core health check, asp net core vs php, asp net developer job, asp net development companies, asp net ecommerce website, asp net events, asp net for beginners, asp net interview questions and answers for 5 years experience, asp net microsoft, asp net middleware, asp net mvc là gì, asp net mvc projects, asp net page life cycle events, asp net pdf generator, asp net programming language, asp net service, asp net web app, c# asp net tutorial, client side validation in asp net, data controls in asp net, entry point of asp net core application, hire asp net developer india, html server controls in asp net, html to pdf asp net, net asp, regular expression validator in asp net, treeview control in asp net

Post navigation

Previous Previous post: Run Dropbox As a Windows Service on Windows Server 
Next Next post: Using log4net to Send Mail With SmtpAppender In a Console Application

Related Posts

  • A new guide to configuring Node packages

    #​607 — January 15, 2026 Read on the Web ⚠️ The Node.js January 13, 2026 Security Releases — Originally expected in December, these releases (of Node.js 25.3.0, 24.13.0, 22.22.0, and 20.20.0) finally landed this week, largely due to their complexity and the scope of the vulnerabilities they tackle. More on that in the next item! The Node.js

    Posted by Posted on January 15, 2026
    0
  • Can we ever fix the web dependency mess?

    #​768 — January 13, 2026 Read on the Web JavaScript Weekly Web Dependencies are Broken; Can We Fix Them? — Lea, who has worked at the heart of Web Standards for years, delivers a compelling (and educational) call to action about a problem every JavaScript developer has encountered: why is managing dependencies and introducing them

    Posted by Posted on January 13, 2026
    0
  • The story of how require(esm) became stable

    #​606 — January 8, 2026 Read on the Web 🎉 Happy New Year! Also, a quick reminder that Node Weekly is now sent every Thursday as part of a reshuffle for many of our newsletters. __Your editor, Peter Cooper npm to Implement ‘Staged Publishing’ After Turbulent Shift Off Classic Tokens — 2025 was a tricky year

    Posted by Posted on January 8, 2026
    0
  • A new JavaScript engine from Fabrice Bellard

    #​767 — January 6, 2026 Read on the Web 🎉 Happy New Year. JavaScript Weekly is now landing in your inboxes on Tuesdays, so here we are! Let’s see what 2026 brings.__Your editor, Peter Cooper JavaScript Weekly The 2025 JavaScript Rising Stars — At the start of each year, Michael rounds up the projects in the

    Posted by Posted on January 6, 2026
    0
  • The JavaScript Bundler Grand Prix

    #​766 — December 19, 2025 Read on the Web 🗓️ As it’s the last issue of 2025, a reminder that JavaScript Weekly moves to Tuesdays in January. See you again on January 6, 2026!__Your editor, Peter Cooper JavaScript Weekly It’s the final issue of the year, so we’re going to cover a few new items, then

    Posted by Posted on December 19, 2025
    0
  • ‘Twas the Node before Christmas…

    #​605 — December 16, 2025 Read on the Web 🗓️ Today we’re taking a look back over some of the big stories and links that got you clicking this year. Also, Node Weekly will be moving to Thursdays in January 2026, as part of a reshuffle for many of our newsletters. __Your editor, Peter Cooper This

    Posted by Posted on December 16, 2025
    0
Judy Alvarez

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Codepolice

  • Github
  • Atlassian
  • Flatlogic
  • Xero
  • Jetbrains
  • Figma
  • A new guide to configuring Node packages
  • Can we ever fix the web dependency mess?
  • The story of how require(esm) became stable
  • A new JavaScript engine from Fabrice Bellard
  • The JavaScript Bundler Grand Prix
https://flatlogic.com/generator
COPYRIGHT © 2026 - Codepolice