How to check whether the server is up in VBScript

Discussion in 'Scripting' started by Jerry, Apr 18, 2007.

  1. Jerry

    Jerry Guest

    Please do tell me how to check whther the url or the webserver is up and
    running using VBScript

    Jerry, Apr 18, 2007
    1. Advertisements

  2. Jerry

    Marty List Guest

    Here's a quick example of how to retrieve a URL from VBScript. Run it from
    a command prompt using a command similar to this:

    CScript.exe filepath\scriptname.vbs

    Option Explicit

    Dim objSvrHTTP

    Set objSvrHTTP = CreateObject("Msxml2.XMLHTTP.4.0") "GET", WScript.Arguments(0), False

    'On Error Resume Next
    If Err.Number = 0 Then
    WScript.Echo objSvrHTTP.responseText
    WScript.Echo "Error: " & Hex(Err.Number)
    End If
    Marty List, Apr 19, 2007
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.