Faster Batch Ping Sweep

Often times, I am working in an environment where installing or even downloading executables on a customer's server is not an option. In these instances I find myself relying on vbscript and batch programs to help me out with things.


After using my original ping sweep batch script a few times, I needed something that would complete the scan much faster.


This script has the potential to slow your computer down a bit as it is going to launch 255 processes as fast as it can, so use it at your own risk. I used it on several servers and did not have any issues, but if you're on a slow computer or a computer with low memory, be patient.


File 1: pingsweep.cmd

@echo off
mkdir list
for /l %%c in (1,1,254) do start pinger 192.168.1.%%c
echo Wait for all ping processes to complete before continuing.

cd list
dir /b > machines.txt
notepad machines.txt
del 192.*

In this script, you just need to change the ip range in the for statement and change the file mask on the last line.


Script 2: pinger.cmd

@echo off
ping -n 1 %1 | find /i "reply from %1"
if errorlevel 1 goto end
echo found > list\%1

This script tries one ping, and then exits. Simple.

Back to Article Index

blog comments powered by Disqus