Jul 042011
Batch Scripting

To check whether a windows server is online or not below is the batch file which will help determine a server is up or not. We can use below functions to create our own script to ping server list.  Through below functions we can execute the batch file ping test easily and reliably.

Ping -n 1 -w 1000 %servername% > nul
REM Echo PingErrLvl:%Errorlevel% & Pause
IF %ErrorLevel% NEQ 0 (
ECHO Connection test to %servername% failed.

ECHO Terminating Batch execution...
ECHO Inputs to machineol.bat are Case-sensitive. Re-Check the options.
) ELSE (
REM ErrLvl 0 means successfully PING
ECHO SUCCESS:Connection Test To %servername%
GOTO EndOnlineTest

Change the %servername% to the original server hostname which you want to check whether the server is online and pingable.

© Incase of any copyright infringements please check copyrights page for faster resolutions.

Leave a Reply

Show Buttons
Hide Buttons