54

I know there is a single line of a command and its arguments that can help display all computer IP addresses (those that are being used) on a LAN, and my computer is also a client, as one of those displayed, but I forgot. What is it?

phuclv
  • 30,396
  • 15
  • 136
  • 260

13 Answers13

40

Not everything with an IP address is a computer - I found none of these suggestions returned all active IP addresses - in fact most returned very few. My home network has a combination of wired and wireless devices and two routers, mobile phones, TV, PVR, Apple AirPort and probably a few things I have forgotten. I used the following to scan all addresses on the 192.168.1.xxx subnet:

for /L %i in (0,1,255) do ping -n 1 -w 250 192.168.1.%i>>ipaddress.txt

The resulting file ipaddress.txt contains the ping results for all addresses and I looked for those with "Received = 1" - currently 16 addresses returned a result - I only have 4 computers in the house - and they were not all on.

Clifford
  • 651
39

You could do the arp -a command to show all ARP entries in the table about computers on your network.

Source

GigabitP
  • 391
12

There is the net view /all command which will list all of the computer names that are connected to the same LAN.

From that you can retrieve the individual IP addresses using the nslookup <computer name> command or write a batch script to do it for you.

Here is an example batch I threw together to illustrate.

@echo off
setlocal EnableDelayedExpansion
set "xNext="
set "xComputer="
for /f %%A in ('net view /all') do (
    set "xComputer=%%~A"
    if "!xComputer:~0,2!"=="\\" for /f "tokens=2,* delims=. " %%X in ('nslookup %%A') do (
        if "!xNext!"=="1" (
            echo.!xComputer! = %%X.%%Y
            set "xNext=0"
        )
        if "!xComputer:~2!"=="%%~X" set "xNext=1"
    )
)
endlocal
pause
9

Aside from arp -a, net view /all, or writing a batch script there is no native/built-in command line to do this (at least not that I know of).

If you're willing to use a non-native command, I would suggest using Nmap. You can run nmap -sn 192.168.0.0/24 (replacing the subnet with the appropriate one for your LAN) to achieve what you're looking for, more reliably so than net view /all or arp -a in my opinion.

Drew Chapin
  • 6,270
7

As indicated by someone else, you can use arp -a however make sure that you ping a broadcast address first so that ARP reports all the devices. For example, ping 192.168.0.255

you get a list of all devices connected to the network by their IP and MAC addresses. you can look up the MAC addresses on a website like https://aruljohn.com/mac.pl to find out who the vendor of the NIC is. This should help you narrow down what most of the devices are. i.e. computers, printers, TV, cell phone, etc..

Sean
  • 71
6

I made this PowerShell script for myself:

for ($i = 1; $i -lt 255; $i++) {
    Test-Connection "192.168.173.$i" -Count 1 -ErrorAction SilentlyContinue
}

the result is very easy to read:

Source        Destination     IPV4Address      IPV6Address                              Bytes    Time(ms) 
------        -----------     -----------      -----------                              -----    -------- 
SHUREEK-PC    192.168.173.1   192.168.173.1                                             32       0        
SHUREEK-PC    192.168.173.76                                                            32       388      
SHUREEK-PC    192.168.173.78                                                            32       66       
SHUREEK-PC    192.168.173.110 192.168.173.110  fe80::6160:1756:c397:5d6e%3              32       0        
SHUREEK-PC    192.168.173.188 192.168.173.188                                           32       79       
SHUREEK-PC    192.168.173.191 192.168.173.191                                           32       0        
1

If you just want to scan your local network and get a list, then google, download, and run "advanced IP scanner". Its free.

Larryc
  • 1,054
0

display all computer IP addresses (those that are being used)

I think you might mean netstat -a this gives you an active list. If you want to know the program using the ip address then use netstat -b (open as administrator).

0

Short answer... I dont think theres a one line Windows OS command to accommodate easily. The easiest way is to see this list in your router software. Simply enter the Default Gateway IP into your browser and log on to your router. It is usually directly on the 1st page that comes up. BTW - if you don't know your Gateway IP - ipconfig will provide it.

-1

This is my quick solution. It tells you what type of device is connected at each ip address:

netstat -r 
DR_WHO
  • 17
  • 1
-1
echo ls %USERDNSDOMAIN%|nslookup
-2

ipconfig /all (use forward slash, not backwards)

Unnikrishnan
  • 1,353
-3

very very simple. use CMD type IPConfig/all