欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2022-04-10 08:10:45
复制代码 代码如下: ip = "jb51.net" wql = "select * from win32_pingstatus where address = '$ip'...
复制代码 代码如下:

ip = "jb51.net"
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
原文: