Need a list of all IP addresses on my network....

echo off
>> report.txt echo *******************************************************************************
>> report.txt echo *******************************************************************************
>> report.txt echo *******************************************************************************
>> report.txt echo.
>> report.txt echo.
set /p userdata=Enter notes for this location:
>> report.txt echo %userdata%
>> report.txt echo %date% %time%
if [%1]==[] goto NOARG
goto GOTARG
:NOARG
>> report.txt echo.
>> report.txt echo ******** IPCONFIG COMMAND ********
>> report.txt echo.
ipconfig /all > ~ip05.txt
>> report.txt type ~ip05.txt
echo FINDING CURRENT IP ADDRESS
ipconfig | find "IP Address" > ~ip01.txt
for /f "tokens=1-2 delims=:" %%i in (~ip01.txt) do echo %%j> ~ip02.txt
for /f "tokens=1-3 delims=." %%i in (~ip02.txt) do echo %%i.%%j.%%k> ~ip03.txt
>> report.txt echo.
>> report.txt echo ******** ROUTE COMMAND ********
>> report.txt echo.
>> report.txt route print
>> report.txt echo.
>> report.txt echo ******** NSLOOKUP COMMAND ********
>> report.txt echo.
>> report.txt nslookup . | find "."
>> report.txt echo.
goto REPORT
:GOTARG
> ~ip02.txt echo %1
for /f "tokens=1-3 delims=." %%i in (~ip02.txt) do echo %%i.%%j.%%k> ~ip03.txt
goto REPORT
:REPORT
>> report.txt echo ******** PING COMMAND ********
>> report.txt echo.
echo PINGING HOSTS IN SUBNET
for /f %%i in (~ip03.txt) do call :PING %%i
>> report.txt type ~ip04.txt
>> report.txt echo.
>> report.txt echo ******** HTTP WEB SERVERS ********
if not exist %0 goto NOHTTP
>> report.txt echo.
echo CHECKING FOR WEB SERVERS
type %0 | find " " | find /v "not me!" > ~ip00.vbs
for /f %%x in (~ip04.txt) do call :HTTP %%x
type ~ip13.txt
>> report.txt type ~ip13.txt
>> report.txt echo.
:NOHTTP
>> report.txt echo ******** NBTSTAT COMMAND ********
>> report.txt echo.
echo CHECKING NAMES WITH NBTSTAT
for /f %%x in (~ip04.txt) do echo %%x & echo %%x >> report.txt & nbtstat -A %%x | find "Registered" >> report.txt && echo %%x>> ~ip11.txt
>> report.txt echo.
>> report.txt echo ******** NET USE COMMAND ********
>> report.txt echo.
echo CHECKING SHARES WITH NET USE
for /f %%x in (~ip04.txt) do call :NETUSE %%x
net use | find "\\" > ~ip10.txt
>> report.txt type ~ip10.txt
>> report.txt echo.
>> report.txt echo ******** NET VIEW COMMAND ********
>> report.txt echo.
echo LISTING SHARED RESOURCES WITH NET VIEW
net view | find "\\" > ~ip08.txt
type ~ip08.txt
>> report.txt echo ----------
>> report.txt type ~ip08.txt
>> report.txt echo ----------
>> report.txt echo.
if exist ~ip11.txt for /f %%x in (~ip11.txt) do call :NETVIEW %%x
>> report.txt echo.
>> report.txt echo ******** ARP COMMAND ********
>> report.txt echo.
>> report.txt arp -a | find "-" | find /v "invalid"
>> report.txt echo %date% %time%
>> report.txt echo.
>> report.txt echo.
>> report.txt echo *******************************************************************************
>> report.txt echo *******************************************************************************
>> report.txt echo *******************************************************************************

If not exist ~ip06.txt goto NOSHARE
set /p userdata=View remote shares (y/n)?
if [%userdata%]==[y] for /f %%x in (~ip06.txt) do start \\%%x
:NOSHARE
if not exist ~ip13.txt goto NOWEB
set /p userdata=View web sites (y/n)?
if [%userdata%]==[y] for /f %%x in (~ip13.txt) do start http://%%x
:NOWEB

:CLEANUP
echo y>~ip09.txt
type ~ip09.txt | net use * /delete
del ~ip??.???
goto :EOF

:NETUSE
net use \\%1\IPC$ "" /USER:"" | find "success"> ~ip12.txt
if not errorlevel 1 echo %1> ~ip06.txt
goto :EOF

:HTTP
cscript.exe ~ip00.vbs %1 >> ~ip13.txt
goto :EOF
On Error Resume Next
Set oHttp = CreateObject("WinHttp.WinHttpRequest.5.1")
oHttp.SetTimeouts 1000, 1000, 1000, 1000
oHttp.Open "GET", "http://" & WScript.Arguments(0), False
oHttp.Send
If err.number = 0 Then Wscript.Echo WScript.Arguments(0) & " " & oHttp.Status
Set oHttp = Nothing

:NETVIEW
net view \\%1 > ~ip07.txt
type ~ip07.txt | find "\\"
type ~ip07.txt | find "Disk"
type ~ip07.txt | find "\\" >> report.txt
type ~ip07.txt | find "Disk" >> report.txt
goto :EOF

:PING
for /L %%x in (1,1,254) do echo %1.%%x & ping -n 1 -w 50 -i 6 %1.%%x | find "Reply" && echo %1.%%x>> ~ip04.txt
goto :EOF
save this as a batch file and run it.
 
Mikol said:
Cheers. It also lists all their mac addresses! That's a very powerful tool round here.
That's not hard to do... just use the ARP command.

Code:
C:\>arp /?

Displays and modifies the IP-to-Physical address translation tables used by
address resolution protocol (ARP).

ARP -s inet_addr eth_addr [if_addr]
ARP -d inet_addr [if_addr]
ARP -a [inet_addr] [-N if_addr]

  -a            Displays current ARP entries by interrogating the current
                protocol data.  If inet_addr is specified, the IP and Physical
                addresses for only the specified computer are displayed.  If
                more than one network interface uses ARP, entries for each ARP
                table are displayed.
  -g            Same as -a.
  inet_addr     Specifies an internet address.
  -N if_addr    Displays the ARP entries for the network interface specified
                by if_addr.
  -d            Deletes the host specified by inet_addr. inet_addr may be
                wildcarded with * to delete all hosts.
  -s            Adds the host and associates the Internet address inet_addr
                with the Physical address eth_addr.  The Physical address is
                given as 6 hexadecimal bytes separated by hyphens. The entry
                is permanent.
  eth_addr      Specifies a physical address.
  if_addr       If present, this specifies the Internet address of the
                interface whose address translation table should be modified.
                If not present, the first applicable interface will be used.
Example:
  > arp -s 157.55.85.212   00-aa-00-62-c6-09  .... Adds a static entry.
  > arp -a                                    .... Displays the arp table.

You can also use this command to list all the network devices/computers your computer has been in contact with at some point. On a non-switched network this would list everyone in the network.
 
NathanE said:
That's not hard to do... just use the ARP command.

Code:
C:\>arp /?

Displays and modifies the IP-to-Physical address translation tables used by
address resolution protocol (ARP).

ARP -s inet_addr eth_addr [if_addr]
ARP -d inet_addr [if_addr]
ARP -a [inet_addr] [-N if_addr]

  -a            Displays current ARP entries by interrogating the current
                protocol data.  If inet_addr is specified, the IP and Physical
                addresses for only the specified computer are displayed.  If
                more than one network interface uses ARP, entries for each ARP
                table are displayed.
  -g            Same as -a.
  inet_addr     Specifies an internet address.
  -N if_addr    Displays the ARP entries for the network interface specified
                by if_addr.
  -d            Deletes the host specified by inet_addr. inet_addr may be
                wildcarded with * to delete all hosts.
  -s            Adds the host and associates the Internet address inet_addr
                with the Physical address eth_addr.  The Physical address is
                given as 6 hexadecimal bytes separated by hyphens. The entry
                is permanent.
  eth_addr      Specifies a physical address.
  if_addr       If present, this specifies the Internet address of the
                interface whose address translation table should be modified.
                If not present, the first applicable interface will be used.
Example:
  > arp -s 157.55.85.212   00-aa-00-62-c6-09  .... Adds a static entry.
  > arp -a                                    .... Displays the arp table.

You can also use this command to list all the network devices/computers your computer has been in contact with at some point. On a non-switched network this would list everyone in the network.
run my script it give you the name of the pc ip mac and lots of other stuff, youll like it.
 
Back
Top Bottom