I'm trying to find out what IP's are being used within a subnet mask. Is there a ping command that will trying pinging all 254 numbers and return replies for those address that are being used? Can it also return the host name of those PCs?
I don't think you can use ping from the command prompt to do this. You could use a 3rd party app such as Samspade, dameware sessionwall. Or search for network monitoring tools.
They allow you to scan subnets for responses. Sessionwall is excellent for this - costly though.
I can't get the -a switch to work for me,(Windows NT 4.0) but here's a batch file that will list the active IP addresses. Just change the base IP address after the "units:" label from
255.255.255.%2
to whatever range you want.
@echo off
if %1!==! goto start
if %1==h goto hundreds
if %1==t goto tens
if %1==u goto units
:start
echo Starting ping
echo Starting ping > pinglist.txt
for %%h in (0,1,2) do call %0 h %%h
goto end
:hundreds
for %%t in (0,1,2,3,4,5) do call %0 t %2%%t
goto end
:tens
for %%u in (0,1,2,3,4,5,6,7,8,9) do call %0 u %2%%u
goto end
:units
ping -n 1 255.255.255.%2|find "Reply from" >> pinglist.txt
IF %2!==259! type pinglist.txt | more
goto end
:LISTIT
type pinglist.txt | more
:end
u can make the following changes to get the host name also.
ping -a -n 1 255.255.255.%2|find "Pinging %Hostname%" >> pinglist.txt
The problem in this is it will list all the ip address including that r note in use, but u can sort out by the ip address with the Hostname are in used.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.