Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alert through Batch file

Status
Not open for further replies.

9885776408

Technical User
Aug 16, 2007
47
US
Hi folks,

I have created a batch file to ping the IP addresses continuesly , If any thing goes wrong like "request timed out "response want to notified me through Mail through Batch file

ping 20.16.4.30
ping 20.16.5.40
...........
..........
etc....

Can anyone help me with this , Thanks in advance
 
There are a lot of programs out there that can send e-mail, but you can also call a vbscript. All you need is an smtp relay, which most people have. Here's the code:

Code:
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "me@mydomain.com"
objEmail.To = "alerts@mydomain.com"
objEmail.Subject = "Your stuff is broke."
objEmail.Textbody = "Fix it."
objEmail.Configuration.Fields.Item _
    ("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing")[/URL] = 2
objEmail.Configuration.Fields.Item _
    ("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver")[/URL] = _
        "smtprelay.com"
objEmail.Configuration.Fields.Item _
    ("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserverport")[/URL] = 25
objEmail.Configuration.Fields.Update
objEmail.Send


You call a vbscript from a batch file with "cscript nameofvbfile.vbs".
 
anyother ways to send a mail from batch file , appreciate Thanks.
 
VB script pls check if anythinh wrong , Its not workout for me:
============

Set objEmail = CreateObject("CDO.request timed out.")
objEmail.From = "swamy.repaka@south.com"
objEmail.To = "alerts.telecom@neth.com"
objEmail.Subject = "Your stuff is broke."
objEmail.Textbody = "Fix it."
objEmail.Configuration.Fields.Item _
(" = 2
objEmail.Configuration.Fields.Item _
(" = _
"objEmail.Configuration.Fields.Item _
(" = 25
objEmail.Configuration.Fields.Update
objEmail.Send
 
You could net send to yourself and it will pop up on your terminal but it gets annoying if the network goes down as you'll get one message after another.
 
I got the SMTP relay for south.com , Please check and let me know , Even i Unable to get the mail through Batch file :


======================================================
Set objEmail = CreateObject("CDO.request timed out.")
objEmail.From = "swamy.repaka@south.com"
objEmail.To = "alerts.telecom@neth.com"
objEmail.Subject = "Your stuff is broke."
objEmail.Textbody = "Fix it."
objEmail.Configuration.Fields.Item _
(" = 2
objEmail.Configuration.Fields.Item _
(" = _
"gcplinggn3rly01.ind.corp.ad"
objEmail.Configuration.Fields.Item _
(" = 25
objEmail.Configuration.Fields.Update
objEmail.Send
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top