VB Script IP Online tester

VB Script IP Online tester

  • Comments 6
  • Likes

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

  • <p>This doesn&#39;t work on aWindows Server 2008R2 domain when run from a Win 7 (Admin) command prompt... but ping does. Any ideas? Thanks</p>

  • <p>That&#39;not true. It works perfectly! My typing is what doens&#39;t work :)</p>

  • <p>.. and yes... &quot;doens&#39;t&quot; was intentional :)</p>

  • <p>And if you have WS2K8/Win7 nodes as well as 2003/XP, this variation of Sudheesh&#39;s script seems to work so far:</p> <p>Option Explicit</p> <p>&#39;On Error Resume Next</p> <p>Dim RangeMin</p> <p>Dim RangeMax</p> <p>Dim WshShell</p> <p>Dim WshExec</p> <p>Dim MinAry</p> <p>Dim MaxAry</p> <p>Dim IPAry</p> <p>Dim times</p> <p>Dim i</p> <p>Dim strPingResults</p> <p>&#39;Range</p> <p>RangeMin = &quot;;</p> <p>RangeMax = &quot;;</p> <p>Set WshShell = CreateObject(&quot;WScript.Shell&quot;)</p> <p>MinAry = Split(RangeMin, &quot;.&quot;, -1, 1)</p> <p>MaxAry = Split(RangeMax, &quot;.&quot;, -1, 1)</p> <p>times = &nbsp;MaxAry(3)- MinAry(3)</p> <p>For i=1 To times</p> <p> IPAry = Join(MinAry, &quot;.&quot;)</p> <p> Set WshExec = WshShell.Exec(&quot;ping -n 1 &quot; &amp; IPAry)</p> <p> strPingResults = LCase(WshExec.StdOut.ReadAll)</p> <p> If InStr(strPingResults, &quot;ttl&quot;) Then</p> <p> WScript.Echo &quot;ONLINE: &quot; &nbsp;&amp; IPAry</p> <p> Else </p> <p> WScript.Echo &quot; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Offline: &quot; &nbsp;&amp; IPAry &nbsp;</p> <p> End If</p> <p> MinAry(3)=MinAry(3)+1</p> <p>Next</p>

  • <p>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 &nbsp;:)</p>

  • <p>how to unlock the forms in vb6.0???</p>

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment