ICMP Component - Samples (Using with VBScript)
VBScript sample, based on OstroSoft ICMP component (OSICMP.dll)
Download sample script

Minimum requirements: OSICMP.dll*
* If you don't have OstroSoft ICMP Component, see installation instructions

1. Create file with extension ".vbs" and open it with text editor of your choice (Notepad is fine)
2. Enter the following code:
sHost = InputBox("Enter host name or IP address", "Ping (OSICMP Test)", "localhost")
Set WshShell = WScript.CreateObject("WScript.Shell")
Set oPing = WScript.CreateObject("OSICMP.Ping")
For i = 0 To 3
oPing.Send sHost
If i = 0 Then
If sHost <> oPing.IP Then s = sHost & " [" & oPing.IP & "]" Else s = sHost
sOutput = "Pinging " & s & " with " & oPing.PacketSize
sOutput = sOutput & " bytes of data:" & vbCrLf & vbCrLf
End If
sOutput = sOutput & "Reply from " & _
oPing.IP & ": bytes=" & oPing.PacketSize & " time=" & _
oPing.RoundTripTime & "ms TTL=" & oPing.TTL & vbCrLf
WshShell.Popup sOutput, 1, "Ping (OSICMP Test)"
'oPing.Sleep 1000
Next
sOutput = sOutput & vbCrLf & "complete"
WshShell.Popup sOutput, , "Ping (OSICMP Test)"
Set oPing = Nothing
Set WshShell = Nothing
|