Scheduled Tasks check
Scheduled Tasks check
Utility that may check status of scheduled tasks available at
www.ks-soft.net/download/utils/schtaskcheck.zip
This is command line utility that can be used with Shell Script test method
http://www.ks-soft.net/hostmon.eng/mfra ... m#chkShell
Usage: schtaskcheck.exe -task:<task_name> -timeframe:<time_interval> [-host:<hostname>] [-user:<username>] [-pswd:<password>] [-ignoreres]
There are 2 mandatory command line parameters:
-task: Scheduled task name
-timeframe: Specifies time interval when the task was expected to be excuted. Interval specified in minutes. E.g. -timeframe:60 means scheduled task had to be executed within last hour.
Also there are several predefined constants you may use: today, yesterday, this_week, last_week, this_month and last_month
3 optional parameters:
-host: Specifies the name or IP address of a remote computer, with or without backslash characters. If omitted, utility checks the local computer
-user: Run the utility with the permission of the specified user account
-pswd: Specifies the password of the user account that is specified in the -user parameter
-ignoreres: This option suppresses additional check for last exit code. If omitted, utility checks task exit code and returns Bad status when exitcode<>0
Examples:
schtaskcheck -task:"Daily Backup" -timeframe:120
schtaskcheck -task:check_log -timeframe:today -host:Second_Server
schtaskcheck -task:check_log -timeframe:today -host:ftp.corp.com -user:admin
schtaskcheck -task:AV_update -timeframe:yesterday -host:192.168.1.100 -user:dsma -pswd:secretphrase -ignoreres
Regards
Alex
www.ks-soft.net/download/utils/schtaskcheck.zip
This is command line utility that can be used with Shell Script test method
http://www.ks-soft.net/hostmon.eng/mfra ... m#chkShell
Usage: schtaskcheck.exe -task:<task_name> -timeframe:<time_interval> [-host:<hostname>] [-user:<username>] [-pswd:<password>] [-ignoreres]
There are 2 mandatory command line parameters:
-task: Scheduled task name
-timeframe: Specifies time interval when the task was expected to be excuted. Interval specified in minutes. E.g. -timeframe:60 means scheduled task had to be executed within last hour.
Also there are several predefined constants you may use: today, yesterday, this_week, last_week, this_month and last_month
3 optional parameters:
-host: Specifies the name or IP address of a remote computer, with or without backslash characters. If omitted, utility checks the local computer
-user: Run the utility with the permission of the specified user account
-pswd: Specifies the password of the user account that is specified in the -user parameter
-ignoreres: This option suppresses additional check for last exit code. If omitted, utility checks task exit code and returns Bad status when exitcode<>0
Examples:
schtaskcheck -task:"Daily Backup" -timeframe:120
schtaskcheck -task:check_log -timeframe:today -host:Second_Server
schtaskcheck -task:check_log -timeframe:today -host:ftp.corp.com -user:admin
schtaskcheck -task:AV_update -timeframe:yesterday -host:192.168.1.100 -user:dsma -pswd:secretphrase -ignoreres
Regards
Alex
When i am trying to monitor schedule tasks execution in different time zone , i receive BAD result becouse of time difference.It doesn't work even after upgrade to last 7.24 version.I use custom folder GMT setting.But shell script execute test with local time
[11:40:06 AM] Script executed, correct result received:
----------
- Status: Bad
- Reply: 15.07.2008 19:38:00 Last Result : 1
Can you fix it please ?
[11:40:06 AM] Script executed, correct result received:
----------
- Status: Bad
- Reply: 15.07.2008 19:38:00 Last Result : 1
Can you fix it please ?
Folder-level "GMT offset" option has nothing to do with external utilities like schtaskcheck.exe. This option affects GUI, reports, schedules.
In many cases you can adjust "timeframe" parameter of the test to make it work. However we added new option "-remotegmt" that allows you to specify GMT offset on target server (minutes).
E.g.
-remotegmt:-300 specified Easter Time zone (GMT -05:00)
-remotegmt:+540 specified Tokyo/Seoul time (GMT +09:00)
New version of the utility available at www.ks-soft.net/download/utils/schtaskcheck.zip
Regards
Alex
In many cases you can adjust "timeframe" parameter of the test to make it work. However we added new option "-remotegmt" that allows you to specify GMT offset on target server (minutes).
E.g.
-remotegmt:-300 specified Easter Time zone (GMT -05:00)
-remotegmt:+540 specified Tokyo/Seoul time (GMT +09:00)
New version of the utility available at www.ks-soft.net/download/utils/schtaskcheck.zip
Regards
Alex
-
- Posts: 2
- Joined: Wed Jan 13, 2010 1:53 pm
-
- Posts: 2
- Joined: Wed Jan 13, 2010 1:53 pm
Sorry, I missed your answer.
Could you please try to setup some other Shell Script test? HostMonitor provides several samples, you may use simply VB or Java script, even BAT file.
This way we will know is problem related to schtaskcheck.exe utility or there is some problem related to external program execution.
What account do you use to run agent?
Regards
Alex
Could you please try to setup some other Shell Script test? HostMonitor provides several samples, you may use simply VB or Java script, even BAT file.
This way we will know is problem related to schtaskcheck.exe utility or there is some problem related to external program execution.
What account do you use to run agent?
Regards
Alex
If it's not to much to ask
I am a newbie admin and I am in need of some help on the Scheduled task check test.
Would somebody be so kind to give me an example of the script to check if the scheduled task with the name “File Transfer to AOD“ completed by a certain time ( for example: it starts at 12AM Eastern Standard Time and has to be completed by 5AM ). No matter what I do I can’t make it work.
Your help is greatly appreciated. Thank you in advance.
Would somebody be so kind to give me an example of the script to check if the scheduled task with the name “File Transfer to AOD“ completed by a certain time ( for example: it starts at 12AM Eastern Standard Time and has to be completed by 5AM ). No matter what I do I can’t make it work.
Your help is greatly appreciated. Thank you in advance.
Have you setup Shell Script test to be executed every day at 5:01AM using command for the script like
schtaskcheck.exe "-task:File Transfer to AOD“ -timeframe:today -host:hostname -user:username -pswd:password
Regards
Alex
schtaskcheck.exe "-task:File Transfer to AOD“ -timeframe:today -host:hostname -user:username -pswd:password
Could you please be more specific? What exactly parameters for the script do you use and what exactly is test result (status and reply)?I can’t make it work.
Regards
Alex
Thank you for your help. I will try that.
The problem was after I clicked on the "let's try" it was not recognizing the scheduled task name.
I can see now that you put the " before -task, I had it after -task like this:
-task "File transfer to AOD" because that's how it was shown in the example in the beginning of the forum. I will try it your way let you know what happened.
The problem was after I clicked on the "let's try" it was not recognizing the scheduled task name.
I can see now that you put the " before -task, I had it after -task like this:
-task "File transfer to AOD" because that's how it was shown in the example in the beginning of the forum. I will try it your way let you know what happened.
I am afraid we need to create different utility for Windows 2008.
On the other hand, if you need to check local system or you can install RMA on target system, then you may use script like the following
Script requires 2 parameters: taskname and timeframe (specified in minutes). E.g. "File Transfer to AOD" 300
Command line to start script: cmd /c cscript /B /E:VBScript %Script% %Params%
Regards
Alex
On the other hand, if you need to check local system or you can install RMA on target system, then you may use script like the following
Code: Select all
Option Explicit
const statusAlive = "scriptRes:Host is alive:"
const statusDead = "scriptRes:No answer:"
const statusUnknown = "scriptRes:Unknown:"
const statusNotResolved = "scriptRes:Unknown host:"
const statusOk = "scriptRes:Ok:"
const statusBad = "scriptRes:Bad:"
const statusBadContents = "scriptRes:Bad contents:"
Dim objArgs, fnd
fnd = 0
Set objArgs = WScript.Arguments
if objArgs.count <> 2 then
WScript.StdOut.Write statusUnknown & "2 arguments expected <TaskName> <timeframe>"
End if
Dim service
' Create the TaskService object.
Set service = CreateObject("Schedule.Service")
call service.Connect()
' Get the task folder that contains the tasks.
Dim rootFolder
Set rootFolder = service.GetFolder("\")
Dim taskCollection
Set taskCollection = rootFolder.GetTasks(0)
If taskCollection.Count = 0 Then
WScript.StdOut.Write statusUnknown & "No tasks are registered."
Else
Dim registeredTask
Dim D1, D1D, Dif
For Each registeredTask In taskCollection
if registeredTask.Name = objArgs(0) then
fnd = fnd + 1
D1 = registeredTask.LastRunTime
D1D = CDate(D1)
Dif = DateDiff("n", D1D, Now())
if Dif > Int(objArgs(1)) then
WScript.StdOut.Write statusBad & "Last Run: " & Dif & " min"
Else
WScript.StdOut.Write statusOk & "Last Run: " & Dif & " min"
End If
End If
Next
if fnd = 0 then
WScript.StdOut.Write statusUnknown & "Task " & objArgs(0) & " NOT found."
End If
End If
Command line to start script: cmd /c cscript /B /E:VBScript %Script% %Params%
Regards
Alex