Results 1 to 4 of 4

Thread: VB script for monitor the scheduled tasks and send Email notification

  1. #1
    Wendy Guest

    VB script for monitor the scheduled tasks and send Email notification

    Any idea about how to write a VB script to monitor the scheduled tasks and send an email notification if a scheduled task does not complete successfully. This is for Windows 2003 server.

    Thanks. Wendy

  2. #2
    Pegasus \(MVP\) Guest

    re: VB script for monitor the scheduled tasks and send Email notification

    Here are a couple of options:

    - Check the ErrorLevel of each command executed by your scheduled task, then use blat.exe (downloadable from many sites) do generate a notification EMail to yourself.
    - Use the Task Scheduler to run this batch file once every few hours:
    01. @echo off
    02. for /F "delims=" %%a in ('schtasks /query /v /fo:list ^| findstr /i
    "Taskname Result"') do call :Sub %%a
    03. goto :eof
    04.
    05. :Sub
    06. set Line=%*
    07. set BOL=%Line:~0,4%
    08. set MOL=%Line:~38%
    09. if /i %BOL%==Task (
    10. set name=%MOL%
    11. goto :eof
    12. )
    13. set result=%MOL%
    14. echo Task Name=%name%, Task Result=%result%
    15. if not %result%==0 (
    16. echo Task %name% failed
    17. echo blat.exe .. .. ..
    18. )

  3. #3
    Join Date
    Jul 2011
    Posts
    265

    Re: VB script for monitor the scheduled tasks and send Email notification

    You can also try using Task Scheduler. You can find some options in the below link. This tool will help you to get the kind of output you are looking for. It is a bit easy to configure any automated things using Task. Because you can configure it in the graphical way. I am not very use to using scripts. Most of the they do not work. I had tried using them many times but it failed. Later on I started using Task with different kind of settings and it worked. There is no issue at all. You can try checking details of below link. There are more relative information available on it.

    Run a Task in Response to a Given Event

  4. #4
    Join Date
    Aug 2011
    Posts
    403

    Re: VB script for monitor the scheduled tasks and send Email notification

    The following link can help you. This link is based on configuring task through script. A sample script is also provided on the same. You have to go through the link and try to understand how it works. You can then configure it as per your need. In the same link there are more topics like WMI Tasks for Scripts and Applications. Where more advance topics are configured. MSDN is the best source to locate information on various things. I always keep on checking new articles here. WMI Tasks for Scripts and Applications is complete guide to manage task with various things.

    WMI Tasks: Scheduled Tasks

Similar Threads

  1. Replies: 5
    Last Post: 11-01-2012, 03:03 AM
  2. How to send email notification program in Visual C++
    By Farzana in forum Software Development
    Replies: 5
    Last Post: 27-06-2011, 05:59 AM
  3. Windows Scheduled Tasks don't luanch if tasks not finished
    By Andy Candy in forum Windows Software
    Replies: 3
    Last Post: 21-08-2009, 11:17 AM
  4. Scheduled Tasks: Notify me of missed tasks
    By Hrishia in forum Windows XP Support
    Replies: 1
    Last Post: 02-01-2009, 02:15 PM
  5. Where are kept Scheduled tasks?
    By Jack in forum Vista Help
    Replies: 8
    Last Post: 18-01-2008, 12:58 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,638,003,924.97950 seconds with 17 queries