Any way to tell if a machine in online?

G

Guest

Hi,

I have a script that I use to check to see if a machine is connected and
online. I am in the process of writing a new .net app that needs this same
kind of functionality. Is there any way to achieve this? This script uses
ping but if something else can provide the same kind of info that would be
great.

Echo %1
PING %1 -n 1 > PING.CHK
FIND /I "Pinging" PING.CHK
IF %ERRORLEVEL%== 1 GOTO HOSTNAME
FIND /I "Reply" PING.CHK
IF %ERRORLEVEL%== 1 GOTO OFFLINE
FIND /I "expired" PING.CHK
IF %ERRORLEVEL%== 1 GOTO DESTINATION
ECHO 4Error,ping expired in transit,%1 >> admreport.csv
goto Next1

:DESTINATION
FIND /I "Destination host unreachable" PING.CHK
IF %ERRORLEVEL%== 1 GoTo Start
ECHO 3Error,Destination host unreachable,%1 >> admreport.csv
GoTo Next1

:OFFLINE
ECHO 1Error,Host is off line,%1 >> admreport.csv
GoTo Next1

:HOSTNAME
ECHO 2ERROR,Host not found in DNS,%1 >> admreport.csv
GoTo Next1

:Start

Too bad I can't just use the Ping that is in V2.0. Any thoughts would be
greatly appreciated.

thanks in advance,
Bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top