How To Ping Multiple Hosts Or IP Addresses At Once

Key Points

  • You can use the command “for /L %z in (1,1,254) do @ping 192.168.10.%z -w 10 -n 1 | find “Reply”” in the Command prompt to ping multiple devices while replacing the variables.
  • For PowerShell, use the command “Test-Connection -ComputerName [IP1], [IP2], [IP3] -Count 1“.

Pinging a computer on the network, a host, a router, or any other device on the network is primarily done by network administrators who are trying to see whether a device or multiple devices are reachable. This is normally performed during a troubleshooting process.

When pinging multiple devices, it can be frustrating to use the Command Prompt/Terminal and ping each IP address or device one by one. Some third-party applications let you automate the pinging process and allow you to pink multiple IP addresses and hosts at the same time. But you can also ping multiple hosts on the network using the native tools on a Windows PC, including the Command Prompt and Windows PowerShell.

In this guide, I am going to show you multiple ways to ping hosts, IP addresses, or routers on your network using both native and third-party tools on a Windows computer.

Ping multiple IP addresses from Command Prompt at once

From the Windows Command Prompt, you need to use the Ping command, followed by a hostname or an IP address, to ping another device and check whether it is accessible or not. If it is accessible, the default ping count, which is 4 times, will show a reply from the remote device.

Using the same logic, if you want to test the accessibility for multiple devices, you must run the Ping command as many times, with a new IP address or hostname each time.

Thankfully, with the following command, you can ping multiple devices on the same IP subnet at once.

for /L %z in (1,1,254) do @ping 192.168.10.%z -w 10 -n 1 | find “Reply”

In the command above, (1,1,254) indicates the values for the variable “z”. It means that the variable “z” will start from “1” and end with “254” with an increment of 1 each time. This means that the command above will start pinging devices that have an IP address of “192.168.10.1”, then “192.168.10.2”, and so on, till it reaches “192.168.10.254”.

You can change the range of IP addresses to ping, as well as the IP address subnet in the command above.

The value after “-w” indicates the waiting time for a ping’s reply. In this case, the “10” indicates 10 seconds which means that it will wait 10 seconds to receive a reply from a device, after which it will move on to the next IP address.

In the end, “find “Reply”” will only show the results from the devices that reply to the ping request.

Here is an example of this command:

Ping multiple hosts from Command Prompt at once
Ping multiple hosts from Command Prompt at once

Ping multiple IP addresses using PowerShell at once

Windows PowerShell gives more control over the commands when pinging multiple IP addresses and hosts at once. To ping multiple devices with PowerShell, use the following command:

Test-Connection -ComputerName [IP1], [IP2], [IP3] -Count 1

In place of [IP1] etc., type in the IP address or hostname of the device that you want to ping. The number after -Count signifies the times to ping each device in the command.

Ping multiple devices using PowerShell at once
Ping multiple devices using PowerShell at once

As you can see in the example above, the command pinged the host as well as the IP addresses 5 times each.

If your PC is connected to a domain, you can ping all of the devices on that domain using this command:

Test-Connection -ComputerName (Get-ADComputer -Filter * | Select-Object -ExpandProperty Name) -Count 1

Of course, it will only work if you are a part of a domain and on the same network.

Additionally, if you frequently need to ping the same hosts or IP addresses, you can create a text file with the information and then use the file to ping the devices. Here is how:

  1. Open Notepad and enter the name of the host or the IP address of the device to ping. Note that each line must contain only one element.

    Create a text file
    Create a text file
  2. Save the file in the .TXT format.

  3. Open PowerShell and use the following command to ping the elements inside a text file, while providing the complete path to the file:

    Test-Connection -ComputerName (Get-Content [PathToTextFile].txt) -Count 1
    Ping multiple devices at once using text file in PowerShell
    Ping multiple devices at once using text file in PowerShell

    Note: If you see an error stating “Error due to lack of resources” such as the one above, it means that the device is unreachable.

Ping multiple IP addresses at once with NirSoft PingInfoView

PingInfoView is a third-party, free, and portable tool that lets you monitor your network connectivity by pinging devices. All you need to do is enter the hostname or the IP address of the machines you want to ping and configure the settings, such as the intervals you want to ping it with.

Simply download PingInfoView, extract the tool, and run the .EXE application. Upon running the tool, enter the name of the host or the IP address of the devices that you want to ping. Note that only one device per line should be entered.

You can also adjust the configuration for pinging the devices, such as the time interval, IPv4 and IPv6 options, etc.

Ping multiple devices at once using PingInfoView
Ping multiple devices at once using PingInfoView

PingInfoView will start pinging the entered devices simultaneously at the configured intervals and show you the results in a separate section within the tool.

Pinging multiple devices simultaneously with PingInfoView
Pinging multiple devices simultaneously with PingInfoView

Closing words

Having the ability to ping multiple devices at the same time just might save a lot of time for the administrators who frequently need to perform this task. You can even create a text file with the IP addresses and host names that you need to ping frequently when troubleshooting.

This guide gives both native and third-party methods that you can adopt to ping multiple devices at the same time, and even automate the task.

If you liked this post, Share it on:
Subhan Zafar is an established IT professional with interests in Windows and Server infrastructure testing and research, and is currently working with Itechtics as a research consultant. He has studied Electrical Engineering and is also certified by Huawei (HCNA & HCNP Routing and Switching).

Leave the first comment

Get Updates in Your Inbox

Sign up for the regular updates and be the first to know about the latest tech information