ojfahoum
asked on
Batch or script file to check if host is alive
I'm trying to write a script that would check if a host is alive via ping, and if not change it's IP address to the dead host's IP address.
Switching IP address could be done with netsh. But I'm not sure how to test the result of the ping.
Thanks in advance.
Switching IP address could be done with netsh. But I'm not sure how to test the result of the ping.
Thanks in advance.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The VBScript worked like a charm. I couldn't get the batch script to work cause it returned ERRORLEVEL = 1 for everything.
Thanks for the help!
Thanks for the help!
I'm a newbie to VBScript, so my question is:
How do I run this VBScript in windows ??
How do I run this VBScript in windows ??
SET CONNECT=an
PING 104.12.0.234 ¦ FIND "TTL=" > NUL
IF ERRORLEVEL 1 SET CONNECT=NO
ECHO %CONNECT% response from device