Simon336697
asked on
PInging by IP Address
Hi guys hope you are well and can help.
I currently run this script by determining if a host is up by pinging its hostname.
What i would like to do though is modify the below script to instead pinging by hostname, ping by its ip address.
Any help greatly appreciated.
I currently run this script by determining if a host is up by pinging its hostname.
What i would like to do though is modify the below script to instead pinging by hostname, ping by its ip address.
Any help greatly appreciated.
@echo off
setlocal enabledelayedexpansion
for /f %%c in (computers.txt) do (
call :GETINFO %%c
echo %%c: !Availability!>>availability.txt
)
goto :eof
:GETINFO
if [%1]==[] goto :eof
Set Availability=
ping %1 -n 2 -w 100 >nul 2>&1
If %errorlevel%==1 goto DOWN
echo %1: Up
Set Availability=Up
goto :eof
:DOWN
echo %1: Down
Set Availability=Down
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Bill, nslookup is a DNS-specific lookup tool, which is why id prefer to use that instead of ping.
The other thing about using nslookup is that you can query the DNS database without the machine being online.
Thanks to all of you really appreciate all your help.