General discussion

Locked

Ping Network

By Sprocket ·
How can i ping all IP Addresses on a network to see which are used and which are free?

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by neilb@uk In reply to Ping Network

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.

Collapse -

by Sprocket In reply to

I have VB Studio 6 installed on my machine, but i havent actually used it.

Collapse -

by neilb@uk In reply to Ping Network

You don't need VB. VBScript will already be installed on any XP,2K or 2K3 system as a standard MS tool.

Collapse -

by Sprocket In reply to

Poster rated this answer.

Collapse -

by Sprocket In reply to Ping Network

This question was closed by the author

Back to Networks Forum
5 total posts (Page 1 of 1)  

Related Forums