JustScriptIt
Technical User
I've been searching how to ping an IP address to extract the computer name.
For instance, if I execute
I get the following output
So far, I couldn't find a way to save the line
to a string. Otherwise, I could split the string and extract
I prefer to get computer name from ping, because there are cases one cannot connect to WMI.
For instance, if I execute
Code:
ping -n 2 -a [IP Address]
I get the following output
Code:
Pinging HostName.suffix.suffix.suffix [IP Address] with 32 bytes of data:
Reply from IP Address: bytes=32 time=7ms TTL=121
Reply from IP Address: bytes=32 time<1ms TTL=121
So far, I couldn't find a way to save the line
Code:
Pinging HostName.suffix.suffix.suffix [IP Address] with 32 bytes of data
to a string. Otherwise, I could split the string and extract
Code:
HostName.suffix.suffix.suffix
I prefer to get computer name from ping, because there are cases one cannot connect to WMI.