What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
300.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Checking scheduled task result

Votes:

0

Your Vote:

Up

Down

Hi,

I would like to monitor scheduled tasks in Windows Server 2003. I need the "last run time" and the "last result code" as channel data and a warning if "last run time" is older than xx minutes or "last result code" <> "0x0" I have read hint to add log file creation to the task but this not good because in this case the "last result code" will not the same as the application exit code.

result scheduled task

Created on Mar 21, 2011 3:05:04 PM by  Attila Kovacs (0) 1



Best Answer

Accepted Answer

Votes:

0

Your Vote:

Up

Down

PTF.ScheduledTask

This is possible with Custom Sensor PTF.ScheduledTask. This sensor returns the number of minutes since the last run of the specified task

-c=   The ip-address or hostname of the computer running the task.
-t=   The name of the task.
-x=   Optional exit code of the task to monitor.
-u=   Optional Domain\Username.
-p=   Optional Password or PassHash

To monitor task "defrag drive c:" on computer "myserver" use:

-c=myserver -t="defrag drive c:"

Optionally provide credentials of an account that can access the Scheduled Taks information and the exit code that the task should return under normal circumstances

The sensor can be downloaded from this page.

Created on Mar 23, 2011 3:29:52 PM by  PRTG Tools Family [prtgtoolsfamily.com] (13,263) 3 4

Last change on Mar 22, 2016 4:47:30 PM by  Gerald Schoch [Paessler Support]



8 Replies

Votes:

0

Your Vote:

Up

Down

Hello,

you would have to have the scheduled task also to write the 'Last Result Code' into the or a file, and read it with the Logfile Content Check Sensor.

Best Regards.

Created on Mar 21, 2011 3:30:48 PM by  Torsten Lindner [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hi,

Just this is my question! The Last result code will generate when my task finished. (Eg exit or error code.) I can not read this value and write into a file by another task. How can I access this value Windows has the log file c:\windows\tasks\SchedLgU.Txt but this have some problem: - can not be read by Logfile Content Check Sensor (access error) - a bit chaotic content: not the last line the last event - it has a line 'exit code (<error code>)' if the task run and has error code but not if the task can't start for example if file not exit on the shared folder

Created on Mar 21, 2011 3:42:28 PM by  Attila Kovacs (0) 1



Votes:

0

Your Vote:

Up

Down

Then you might have to program equivalent debugging code and information into the "application" started in the scheduled task so that this one itself created a valuable logfile. Otherwise, it might simply be not possible.

Created on Mar 21, 2011 3:47:07 PM by  Torsten Lindner [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Thanks for your Tip I will do it...

Created on Mar 21, 2011 3:49:32 PM by  Attila Kovacs (0) 1



Accepted Answer

Votes:

0

Your Vote:

Up

Down

PTF.ScheduledTask

This is possible with Custom Sensor PTF.ScheduledTask. This sensor returns the number of minutes since the last run of the specified task

-c=   The ip-address or hostname of the computer running the task.
-t=   The name of the task.
-x=   Optional exit code of the task to monitor.
-u=   Optional Domain\Username.
-p=   Optional Password or PassHash

To monitor task "defrag drive c:" on computer "myserver" use:

-c=myserver -t="defrag drive c:"

Optionally provide credentials of an account that can access the Scheduled Taks information and the exit code that the task should return under normal circumstances

The sensor can be downloaded from this page.

Created on Mar 23, 2011 3:29:52 PM by  PRTG Tools Family [prtgtoolsfamily.com] (13,263) 3 4

Last change on Mar 22, 2016 4:47:30 PM by  Gerald Schoch [Paessler Support]



Votes:

0

Your Vote:

Up

Down

I've been checking this out and I am not sure its working correctly with Windows 2008. For instance:

schtasks command on the server:
Folder: \
TaskName                                 Next Run Time          Status
======================================== ====================== ===============
Database Backup                          5/29/2011 3:00:35 AM   Ready
Inventory                                5/31/2011 12:19:10 AM  Ready

Running the ptf exe manually

ScheduledTask.exe -c=servername -t="Inventory" -x=0 -u=domainname\username -p=h:/k7ULyAHIpzNhSeIRqWMgw== (passwordhash)

Task Inventory not found on host servername

Now, I've obviously left out the actual values above, but it does seem like its not reading the tasks on Windows 2008

When I deliberately change the password hash, it gives me the impersonation error so I know the account information is correct.

Created on May 29, 2011 3:34:17 AM by  MarkH (0)

Last change on May 30, 2011 2:01:19 PM by  Torsten Lindner [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hi Mark,

This bug is supposed to be fixed in version 8.0.2 of the sensor, that somehow never was published :-(. Please download this version and let me know if this solves your problem.

Created on May 30, 2011 2:42:57 PM by  PRTG Tools Family [prtgtoolsfamily.com] (13,263) 3 4

Last change on May 30, 2011 3:26:10 PM by  Patrick Hutter [Paessler Support] (7,225) 3 3



Votes:

0

Your Vote:

Up

Down

Hello!

I cannot find the PTF.ScheduledTask custom sensor at the link provided: http://code.google.com/p/prtg-addons/wiki/PTF_Custom_Sensors

Was this removed or discontinued?

Created on Nov 13, 2012 5:32:42 PM by  vijay (0)



Please log in or register to enter your reply.


Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.