Submitted By: Maurice Childs

Reports the availability of two Web sites.

Visual Basic
Edit|Remove
On Error Resume Next

Set objExplorer = CreateObject("InternetExplorer.Application")
objExplorer.Navigate "about:blank"   
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Width=600
objExplorer.Height = 800 
objExplorer.Left = 0
objExplorer.Top = 0
objExplorer.Title = "Ping Test"
 
Do While (objExplorer.Busy)
    Wscript.Sleep 200
Loop    
objExplorer.Visible = 1     
 
arrComputers = Array("www.microsoft.com","news.bbc.co.uk") 
strHTML = "<h2>Ping Progress</h2>"
strHTML = strHTML & "<table id='ComputerList' width='100%' border>" 

For Each strComputer in arrComputers
    strHTML = strHTML & "  <tr>"
    strHTML = strHTML & "    <td width='100%'>" & strComputer & "</td>"
    strHTML = strHTML & "  </tr>"
Next
 
strHTML = strHTML & "</table>"
objExplorer.Document.Body.InnerHTML = strHTML
 
Wscript.Sleep 2000
 
For i = 0 to UBound(arrComputers) + 1
    objExplorer.Document.Body.All.ComputerList.Rows(i).bgColor = "yellow"
    objExplorer.Document.Body.All.ComputerList.Rows(i).bgColor = Pingit(arrComputers(i))
Next

'==========================
Function PingIT(Target)
'==========================

Set PingResults = GetObject("winmgmts://./root/cimv2").ExecQuery _
    ("SELECT * FROM Win32_PingStatus WHERE Address = '" & Target & "'")
    For Each PingResult In PingResults
        If PingResult.StatusCode = 0 then
            Pingit  = "lightgreen"
        else 
           pingit = "red"
        end if
    Next
End Function