Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PING commands

Status
Not open for further replies.

EST7745

IS-IT--Management
May 6, 2003
306
US
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?
 
ping -a xxx.xxx.xxx.xxx

will return the hostname, don't know about your first question though you could write a script to do it.

-------------------------------

If it doesn't leak oil it must be empty!!
 
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
 
ping -n 1 255.255.255.%2|find "Reply from" >> pinglist.txt

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.

PSingh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top