首页 > 编程 > VBScript > 正文

WMI中的Win32_PingStatus类(ping命令实现)

2020-07-26 11:51:10
字体:
来源:转载
供稿:网友
复制代码 代码如下:

IP = "VeVB.COm"
WQL = "Select * from Win32_PingStatus Where Address = '$IP'"
WQL = Replace(WQL,"$IP",IP)
n = 0 : s = 0
Do Until n = 100
Set objWMIService = GetObject("winmgmts://./root/cimv2")
Set colItems = objWMIService.ExecQuery(WQL,,48)
For Each objItem in colItems
If objItem.StatusCode = 0 Then
s = s + objItem.ResponseTime
n = n + 1
End If
Next
Loop
WScript.Echo "Average:" & s / n

参考链接:Win32_PingStatus Class
原文:http://demon.tw/programming/wmi-win32_pingstatus.html

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表