Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ICMP

Status
Not open for further replies.

SCoyote

Programmer
Nov 12, 2001
5
US
I am trying to write a program that will ping out from the client side comp. The issue is that I would also like to display the results from the ping on the web page. I would like to know if it is possible to capture the output from the console window using a scripting language , or can I use ICMPsendEcho from a script.
 
Set oShell = CreateObject("WScript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
oShell.Run "command /C ping HostOrIP > C:\ping.txt",0,True
If oFSO.FileExists("C:\ping.txt") Then
Set oFile = oFSO.OpenTextFile("C:\ping.txt",1)
sOutput = oFile.ReadAll
oFile.Close
Set oFile = Nothing
oFSO.DeleteFile "C:\ping.txt", True
'do what you wish with sOutput
Else
'something went wrong
End If
Set oFSO = Nothing
Set oShell = Nothing Jon Hawkins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top