Solved

Monitor Windows Scheduled Tasks Last Run Result

Posted on 2013-06-05
1
1,869 Views
Last Modified: 2013-06-05
I would like to set up some kind of alert that tells me when a task runs with a result and returns anything other than 0x0. Obviously if the scheduled task runs and the action returns an error code, the Task Scheduler still returns as successful so it's not possible to set up monitoring from the Event Viewer

My server is running Windows Server 2008 R2

How can I set up monitoring to check the Last Run Result?

Thanks in advance
0
Comment
Question by:bumbl
1 Comment
 

Accepted Solution

by:
bumbl earned 0 total points
ID: 39221382
I solved this issue with a PowerShell script. I found it here

http://serverfault.com/questions/436720/is-it-possible-for-a-powershell-script-to-return-the-last-run-result-from-window

$taskName = "ETL"
$result = (schtasks /query /FO LIST /V /TN $taskName | findstr "Result")
$result = $result.substring(12)
$lastResult = $result.trim()
0

Featured Post

Want to promote your upcoming event?

Attending an event? Speaking at a conference? Or exhibiting at a tradeshow? Easily inform your contacts by using a promotional banner in your email signature. This will ensure your organization’s most important contacts are in the know.

Join & Write a Comment

Suggested Solutions

I was supporting a handful of Windows 2008 (non-R2) 2 node clusters with shared quorum disks. Some had SQL 2008 installed and some were just a vendor application that we supported. For the purposes of this article it doesn’t really matter which so w…
New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
This tutorial will give a short introduction and overview of Backup Exec 2012 and how to navigate and perform basic functions. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as conne…
This tutorial will show how to configure a new Backup Exec 2012 server and move an existing database to that server with the use of the BEUtility. Install Backup Exec 2012 on the new server and apply all of the latest hotfixes and service packs. The…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now