берем этот код в текстовый файл и меняем на .vbs
strComputers = "192.168.98.5,LA1DVCONSVR001,jenkins.d3nw.net" 'use comma: "192.168.98.5,192.168.98.6"
arrComputers = SPLIT(strComputers, ",")
for each strComputer in arrComputers
set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}")._
ExecQuery("select * from Win32_PingStatus where address = '" & _
strComputer & "'")
for each objPingStatus in objPing
if ISNULL(objPingStatus.StatusCode) or objPingStatus.StatusCode<>0 then
if strFailedPings <> "" then strFailedPings = strFailedPings & vbcrlf
strFailedPings = strFailedPings & strComputer
end if
next
next
if strFailedPings = "" then
strOK = "Ping status of specified computers is OK:" & vbcrlf
for each strComputer in arrComputers
strOK = strOK & strComputer & vbcrlf
next
wscript.echo strOK
else
wscript.echo "Ping failed for the following computers:" & _
vbcrlf & vbcrlf & strFailedPings
end if
No comments:
Post a Comment