VB Script IP Online tester

This script will show which all IP address are in use for a range of IP and also check whihc all are online and whihc all are offline.


‘Script Written by Sudheesh Narayanaswamy
‘This can be used to check the IP address which are in use currentely. It will tell you which all IP are online and which all are offline
‘SET teh Minnum Rnage and Maximum range’Name the service which you want to check in the Varable sService (Name of service in uppercase)
‘Usuage cscript <FILENAME.VBS> will output to dos and in case you want to save this cscript <FILENAME.VBS> output.log

 ‘Set the values to test
RangeMin = ”″
RangeMax = ”″

Set WshShell = CreateObject(“WScript.Shell”)

MinAry = Split(RangeMin, “.”, -1, 1)
MaxAry = Split(RangeMax, “.”, -1, 1)

times =  MaxAry(3)- MinAry(3)

For i=1 To times
IPAry = Join(MinAry, “.”)

PINGFlag = Not CBool(WshShell.run(“ping -n 1” & IPAry ,0,True))
If PINGFlag = True Then        
WScript.Echo “Online”  & IPAry
WScript.Echo “Ofline”  & IPAry 
End If


Hope this will be helpful

Sudheesh Narayanaswamy | Support Engineer

Comments (6)

  1. Ram Karthik says:

    how to unlock the forms in vb6.0???

  2. Anonymous says:

    That'not true. It works perfectly! My typing is what doens't work 🙂

  3. Anonymous says:

    And if you have WS2K8/Win7 nodes as well as 2003/XP, this variation of Sudheesh's script seems to work so far:

    Option Explicit

    'On Error Resume Next

    Dim RangeMin

    Dim RangeMax

    Dim WshShell

    Dim WshExec

    Dim MinAry

    Dim MaxAry

    Dim IPAry

    Dim times

    Dim i

    Dim strPingResults


    RangeMin = ""

    RangeMax = ""

    Set WshShell = CreateObject("WScript.Shell")

    MinAry = Split(RangeMin, ".", -1, 1)

    MaxAry = Split(RangeMax, ".", -1, 1)

    times =  MaxAry(3)- MinAry(3)

    For i=1 To times

    IPAry = Join(MinAry, ".")

    Set WshExec = WshShell.Exec("ping -n 1 " & IPAry)

    strPingResults = LCase(WshExec.StdOut.ReadAll)

    If InStr(strPingResults, "ttl") Then

    WScript.Echo "ONLINE: "  & IPAry


    WScript.Echo "                       Offline: "  & IPAry  

    End If



  4. Sudheesh N says:

    Not Sure It works for me in Windows 7 and Windows 2008 R2 as well … Just need to run from Run as administartor prompt. Rather i tested this script in windows 7 PC  🙂

  5. Anonymous says:

    This doesn't work on aWindows Server 2008R2 domain when run from a Win 7 (Admin) command prompt… but ping does. Any ideas? Thanks

  6. Anonymous says:

    .. and yes… "doens't" was intentional 🙂

Skip to main content