Submitted By: Anonymous Submission

Pings a server and emails an alert if the computer is not available. GBMail is a popular freeware command-line emailer utility, but any other email utility can be used.

Visual Basic
Edit|Remove
@echo off

PING servername -n 1 | FIND "TTL" >NUL
IF NOT ERRORLEVEL 1 GOTO QUIT

PING servername -w 10000 | FIND "TTL" >NUL
IF ERRORLEVEL 1 ECHO GOTO MAIL

:MAIL
echo Error pinging server!
gbmail -from Ping@domain.com -to recepient@domain.com -s "Pinging servername: no response" -h SMTPserver

:QUIT