We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Script to monitor scheduled task

andressk
andressk asked
on
Medium Priority
745 Views
Last Modified: 2012-05-11
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

Comment
Watch Question

Top Expert 2011
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
Bill PrewTest your restores, not your backups...
CERTIFIED EXPERT
Expert of the Year 2019
Top Expert 2016

Commented:
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
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
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.
Bill PrewTest your restores, not your backups...
CERTIFIED EXPERT
Expert of the Year 2019
Top Expert 2016
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
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.

Author

Commented:
No new replies. Found the the solution here at the company
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.