Link to home
Start Free TrialLog in
Avatar of andressk
andresskFlag for Colombia

asked on

Script to monitor scheduled task

Hello,

I´m working on monitoring scheduled tasks in different windows servers. Is there any script that I can use to do this?
I´ve found an example but I´m not sure if it works because I don´t know the arguments.

Thanks for your help
Dim WshShell,oExec
Set WshShell = CreateObject("WScript.Shell")
Set oExec = WshShell.Exec("schtasks /query /fo list /v")
 
strHold = oExec.StdOut.ReadAll
strHold = Replace(strHold,Chr(10),"<br> ")
 
WScript.Echo "Message:" & strHold
WScript.Echo "Statistic:0"
WScript.Quit(SUCCESS)

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of prashanthd
prashanthd
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bill Prew
Bill Prew

What information do you want to see, and how do you want it presented?

Will you be processing a list of servers or individual servers?

Will you be running this on each server, or running from a central server and want to query the remote servers?

~bp
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of andressk

ASKER

Hi, thanks for your reply,

In fact, the script will be running from a central server and I want to query the remote servers.
The information that I want to see is the status of all the scheduled tasks that I have on all the remote servers, for example if a task execution was successful.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi billprew,

Thanks as always for your help.

You are right, the number of jobs is very high if I want to monitor all of them, and the load of the servers may be impacted.
Let me explain what I want to do:
We use Solarwinds APM to monitor our critical apps, and for those apps that don´t have specific processes or services, we use custom vb scripts that can be imported into the monitoring tool, such as the one of the example.

We have applications on 2 servers like Jboss that run only by *.bat files that are started all mornings by scheduled tasks, and those .bat processes can´t be monitored remotely one by one from the monitoring tool, we only see one process and can´t see the individual status. Directly on the server we can check the status of the jboss processes in the server with a cmd screen for every process (around 15). The fact is that we don´t know when a problem occurs on one process until it´s too late, and we have had a lot of problems because of that. So, the easiest way that we found is checking the scheduled tasks that run those .bat processes, but I don´t know if there´s is a more appropriate way of doing it.

There are 2 remote servers: one main server and one that is the backup.
No new replies. Found the the solution here at the company