DAConsult Forums
DAConsult Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Windows
 Small Business Server
 Ping Sweep Script

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert Email Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
1029usr078198 Posted - December 29 2007 : 10:37:35
Here's a Visual Basic, Scripting Edition version of a "Ping Sweep". A ping sweep finds all the IP addresses in use in a particular range.

Here's the code:

On Error Resume Next

intStartingAddress = 1
intEndingAddress = 100
strSubnet = "192.168.3."

For i = intStartingAddress to intEndingAddress
strComputer = strSubnet & i

Set objShell = CreateObject("WScript.Shell")
strCommand = "%comspec% /c ping -n 3 -w 1000 " & strComputer & ""
Set objExecObject = objShell.Exec(strCommand)

Do While Not objExecObject.StdOut.AtEndOfStream
strText = objExecObject.StdOut.ReadAll()
If Instr(strText, "Reply") > 0 Then

' =====================================================================
' Insert your code here
' =====================================================================

Set objWMIService = GetObject _
("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * From Win32_OperatingSystem")
For Each objItem in ColItems
Wscript.Echo strComputer & ": " & objItem.Caption
Next

' =====================================================================
' End
' =====================================================================

Else
Wscript.Echo strComputer & " could not be reached."
End If
Loop
Next



Hope it helps,
David

DAConsult Forums © 2007-2010 David Anderson Consulting Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000 Version 3.4.06