Discussion Locked

Ping Network

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
How can i ping all IP Addresses on a network to see which are used and which are free?

5 replies

by Member 25348569

A vbscript will do it
--------------
Option Explicit
Dim objShell, strSubnet, i
Set objShell = CreateObject("WScript.Shell")
strSubnet = "10.130.32." 'Obviously set this to yours! And note the trailing stop
For i = 1 to 255
If IsUp(strSubnet & i) Then
wscript.echo strSubnet & i & " is up"
End If
Next
wscript.quit(0)

' ---------------------------------

Function IsUp(sIPAddress)

Dim stdOut, objScriptExec, strPingResults
Set StdOut = WScript.StdOut
On Error Resume Next
Set objScriptExec = objShell.Exec("ping -n 2 -w 500 " & sIPAddress)
strPingResults = LCase(objScriptExec.StdOut.ReadAll)
Set stdOut = Nothing
set objScriptExec = Nothing
IsUp = False
If InStr(strPingResults, "reply from") Then IsUp = True

End Function
---------------

Save it as, say, scansubnet.vbs and then run cscript scansubnet.vbs in a CMD box.

This discussion is closed to new replies.