WMI의 Win32PingStatus 클래스(ping 명령 실행)

690 단어
 
  
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

참조 링크: Win32PingStatus Class 텍스트:http://demon.tw/programming/wmi-win32_pingstatus.html

좋은 웹페이지 즐겨찾기