Re: send mail if ping faile
- From: "Pegasus \(MVP\)" <I.can@xxxxxxxxxx>
- Date: Fri, 30 Jan 2009 11:30:54 +0100
"skepper" <skepper.3mtmlj@xxxxxxxxxxxxx> wrote in message
news:skepper.3mtmlj@xxxxxxxxxxxxxxxx
i try it:
PingTest.cmd
----------------------------------------------------
@echo off
:Again
ping mis | find /i "bytes=" || goto Fail
ping localhost -n 60 > nul
goto Again
:Fail
call mail.vbs
----------------------------------------------------
the mail.vbs is:
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "PingTester@xxxxxxxxxxxx"
objEmail.To = "Admin@xxxxxxxxxxxx"
objEmail.Subject = !Attention Message!"
objEmail.Textbody = "Ping to Server Fail!"
objEmail.Send
if i remove the line @echo off, i get this masage :
ping server| find /i "bytes=" || goto Fail
ping server| find /i "bytes=" || goto Fail
ping server| find /i "bytes=" || goto Fail
ping server| find /i "bytes=" || goto Fail
The process tried to write to a nonexistent pipe.
The process tried to write to a nonexistent pipe.
The process tried to write to a nonexistent pipe.
?
--
skepper
------------------------------------------------------------------------
skepper's Profile: http://forums.techarena.in/members/skepper.htm
View this thread: http://forums.techarena.in/server-scripting/1111495.htm
http://forums.techarena.in
Try this batch file for starters:
@echo off
:Again
ping mis | find /i "bytes=" || goto Fail
ping localhost -n 60 > nul
goto Again
:Fail
echo Ping failed!
Does it work?
==================
I have a few problems with your VB Script. Here they are:
1. Instead of writing
call mail.vbs
you should write
script //nologo c:\mail.vbs
2. Your script lacks the details that are required under
objEmail.Configuration.Fields
3. The line
objEmail.Subject = !Attention Message!"
lacks a double quote after the = character.
If you are not familiar with VB Scripts then you would be much better off
using blat.exe, as I suggested in my first reply.
.
- References:
- send mail if ping faile
- From: skepper
- Re: send mail if ping fails
- From: Pegasus \(MVP\)
- Re: send mail if ping faile
- From: skepper
- send mail if ping faile
- Prev by Date: Script to set user permissions
- Next by Date: Re: ftp script
- Previous by thread: Re: send mail if ping faile
- Next by thread: List NIC binding order
- Index(es):
Relevant Pages
|