VBScript: When You Can't Use Powershell to Ping a Webpage...

Sometimes, there's a need to schedule a "ping" to a webpage (that needs to be pre-compiled, for instance). While using PowerShell is the easiest way to do this, it's not always available on older server, while VBScript is nearly always a safe bet. The biggest issue with using VBScript or the command line is what to do with the window it may open. Instead of using iexplore and taskkill, using the following VBScript is my fav alternative.

Call pingPage ("https://www.domain.com")

Function pingPage (strURL) Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP")

objXMLHTTP.open "GET", strURL, false objXMLHTTP.send()

If objXMLHTTP.Status <> 200 Then 'email someone about it End if

Set objXMLHTTP = Nothing End Function
On a related note: the PowerShell line looks something like this: $pingPage = (new-object net.webclient).DownloadString("https://www.domain.com")