hi,
i am trying to make ping response graphs on a win2k server....
i can not use the ping.pl
is there a way to do it on a win2k server??
thx for help
ping response on win2k
Moderators: Developers, Moderators
ping
I wrote a VBS script :
Dim oArgs, Answer, fso
Set oArgs = WScript.Arguments
If oArgs.Count <> 1 Then Wscript.Quit(0)
Set MyShell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Const TempFile = "./ping.txt"
Program = "%comspec% /c ping.exe -n 1 " & oArgs(0) & " >" & TempFile
Return = MyShell.Run(Program,0,True)
Set MyFile = fso.OpenTextFile(TempFile)
Answer = MyFile.ReadAll
MyFile.Close()
'Set MyFile = fso.GetFile(TempFile)
'MyFile.Delete
If InStr(Answer,"ytes=") Then
p= InStr(Answer,"Average")
Wscript.StdOut.Write Val(Trim(Mid(Answer,p+10,10)))
Else
Wscript.StdOut.Write "0"
End If
Wscript.Quit(0)
function Val(vValue)
Dim lCount
Dim lResult
Dim strResult
if len(vValue) = 0 Then
lResult = 0
Else
if isnumeric(vValue) Then
lResult = cdbl(vValue)
Else
lCount = 1
Do until (isnumeric(mid(vValue,lCount,1))=false) or (lCount > len(vValue))
strResult = strResult & mid(vValue, lCount, 1)
lCount = lCount + 1
Loop
if len(strResult) = 0 Then
lResult = 0
Else
lResult = cdbl(strResult)
End if
End if
End if
Val = lResult
End function
Dim oArgs, Answer, fso
Set oArgs = WScript.Arguments
If oArgs.Count <> 1 Then Wscript.Quit(0)
Set MyShell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Const TempFile = "./ping.txt"
Program = "%comspec% /c ping.exe -n 1 " & oArgs(0) & " >" & TempFile
Return = MyShell.Run(Program,0,True)
Set MyFile = fso.OpenTextFile(TempFile)
Answer = MyFile.ReadAll
MyFile.Close()
'Set MyFile = fso.GetFile(TempFile)
'MyFile.Delete
If InStr(Answer,"ytes=") Then
p= InStr(Answer,"Average")
Wscript.StdOut.Write Val(Trim(Mid(Answer,p+10,10)))
Else
Wscript.StdOut.Write "0"
End If
Wscript.Quit(0)
function Val(vValue)
Dim lCount
Dim lResult
Dim strResult
if len(vValue) = 0 Then
lResult = 0
Else
if isnumeric(vValue) Then
lResult = cdbl(vValue)
Else
lCount = 1
Do until (isnumeric(mid(vValue,lCount,1))=false) or (lCount > len(vValue))
strResult = strResult & mid(vValue, lCount, 1)
lCount = lCount + 1
Loop
if len(strResult) = 0 Then
lResult = 0
Else
lResult = cdbl(strResult)
End if
End if
End if
Val = lResult
End function
Who is online
Users browsing this forum: No registered users and 0 guests