Скрипт проверки доступности хостов

Option Explicit
On Error Resume Next
Const ONE_HOUR = 100 
'Const ONE_HOUR = 3600000 a real hour
Dim strMachines 
dim aMachines 
dim machine 
Dim i 
Dim ihours
Dim objPing 
Dim objStatus 


strMachines = "machine1;machine2"
aMachines = split(strMachines, ";")

For ihours = 1 To 8
	For Each machine In aMachines
		For i = 1 To 3
			Set objPing = GetObject("winmgmts:")._
				ExecQuery("select * from Win32_PingStatus where address = '"_
				& machine & "'")
			For Each objStatus In objPing
				If IsNull(objStatus.StatusCode) Or objStatus.StatusCode<>0 Then
					WScript.Echo("machine " & machine & " is not reachable")
				Else
					WScript.Echo("reply from " & machine)
				End If
			Next
		Next
	Next
	WScript.Sleep(ONE_HOUR)
Next
WScript.Echo("the day is done")


Также интересно:

Интересное на сайте: 
0
Голосов пока нет

Оставить комментарий