?
Solved

Monitor Windows Scheduled Tasks Last Run Result

Posted on 2013-06-05
1
Medium Priority
?
2,229 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

Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I had a question today where the user wanted to know how to delete an SSL Certificate, so I thought that I would quickly add this How to! Article for your reference. WHY WOULD YOU WANT TO DELETE A CERTIFICATE? 1. If an incorrect certificate was …
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This tutorial will walk an individual through the steps necessary to configure their installation of BackupExec 2012 to use network shared disk space. Verify that the path to the shared storage is valid and that data can be written to that location:…
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
Suggested Courses

840 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