Link to home
Start Free TrialLog in
Avatar of SAM2009
SAM2009Flag for Canada

asked on

Is there a script which can tell if a serveur respond to a ping request?

Is there a script which can tell if a serveur respond to a ping request? I have list of server in txt file.
SOLUTION
Avatar of KenMcF
KenMcF
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
if you want batch script then below can be used.

@echo off & setlocal enabledelayedexpansion
for /f %%a in (list.txt) do (

ping -n 1 %%a >%temp%\pngoutput.bat 
findstr /i "TTL" %temp%\pngoutput.bat >nul
if !errorlevel!	== 0 echo Server %%a responded to ping
if !errorlevel!	== 1 echo Server %%a is not responding to ping
)

Open in new window

SOLUTION
Avatar of RobSampson
RobSampson
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SAM2009

ASKER

Hey guys is the script that your provide can put the info in same file as teh server's file like:

server_name1 respond
server_name2  not respond
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Let me know if you are using 2008 servers.. In that case will have to change the a little bit...instead of finding "TTL" find "reply"
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SAM2009

ASKER

Thank you for all your helps!