To check if url is working and send a status report through mail

We have some upgraded going on some of our web severs.
Till that time we need check many urls manually daily.

I want to write a vb script to check urls if it is up or not and send us status report through mail.

urls address start with https:// and we need to use F5 Token and disable proxy setting to connect those server.

we don't have power shell access as well.

could somebody please help me to write a vbscript or bat script to automate these stuff.
sandeep KumarAsked:
Who is Participating?
An Average Forum Participant Just For FunHardware Tester and DebuggerCommented:
This script will both ping a website and check it for content to verify that it is online. If the website if offline, it will send a email notification. This script writes to a log file every time it runs so that you can check to make sure it is working as expected. Combine this script with a scheduled task to actively monitor the website.

' Purpose: Tests to make sure a website is online.
' Created By: An Average Forum Participant Just For Fun
' Notes: This script will scan a website and send an alert
' email out when there is either no ping or no content.
' It also keeps a log of each scan.
' I recommend setting up a scheduled task to run this
' script regularly.
Option Explicit
'Configure the script here
Dim strLogFile, strEmailHost, strFromEmail, strToEmail, strSubjectMsg, strWebsite
strLogFile = "\\PATHTOSERVER\log.txt"
strSubjectMsg = "Website Alert" 

'Tests the website for both ping and content
Dim strAlert, strWebStatus
If PingSite ( strWebsite ) Then
	Dim strWebContent
	strWebContent = GetDataFromURL("http://" & strWebsite, "GET", "")
	If len(strWebContent) > 100 Then
		SendToLog( "Up" )
		SendToLog( "Down" )
		strAlert = "No Content"
		strWebStatus = "Down"
	End IF
	SendToLog ( "Down" )
	strAlert = "No Ping"
	strWebStatus = "Down"
End If

If strWebStatus = "Down" Then
End If

'Creates a record in the log
Function SendToLog ( strStatus )
Dim dtmTimeStamp, objFSO, objLogFile
dtmTimeStamp = now()
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objLogFile = objFSO.OpenTextFile(strLogFile, 8, TRUE)
objLogFile.Write "Time: " & dtmTimeStamp & " Status: " & strStatus & vbCrLf
End Function

'Gets web content
Function GetDataFromURL ( strURL, strMethod, strPostData )
Dim lngTimeout, strUserAgentString, intSslErrorIgnoreFlags, blnEnableRedirects
Dim blnEnableHttpsToHttpRedirects, strHostOverride, strLogin, strPassword
Dim strResponseText, objWinHttp
  lngTimeout = 59000
  strUserAgentString = "http_requester/0.1"
  intSslErrorIgnoreFlags = 13056 ' 13056: ignore all err, 0: accept no err
  blnEnableRedirects = True
  blnEnableHttpsToHttpRedirects = True
  strHostOverride = ""
  strLogin = ""
  strPassword = ""
  Set objWinHttp = CreateObject("WinHttp.WinHttpRequest.5.1")
  objWinHttp.SetTimeouts lngTimeout, lngTimeout, lngTimeout, lngTimeout
  objWinHttp.Open strMethod, strURL
  If strMethod = "POST" Then
    objWinHttp.setRequestHeader "Content-type", _
  End If
  If strHostOverride <> "" Then
    objWinHttp.SetRequestHeader "Host", strHostOverride
  End If
  objWinHttp.Option(0) = strUserAgentString
  objWinHttp.Option(4) = intSslErrorIgnoreFlags
  objWinHttp.Option(6) = blnEnableRedirects
  objWinHttp.Option(12) = blnEnableHttpsToHttpRedirects
  If (strLogin <> "") And (strPassword <> "") Then
    objWinHttp.SetCredentials strLogin, strPassword, 0
  End If    
  On Error Resume Next
  If Err.Number = 0 Then
    If objWinHttp.Status = "200" Then
      GetDataFromURL = objWinHttp.ResponseText
      GetDataFromURL = "HTTP " & objWinHttp.Status & " " & _
    End If
    GetDataFromURL = "Error " & Err.Number & " " & Err.Source & " " & _
  End If
  On Error GoTo 0
  Set objWinHttp = Nothing
 End Function
'Pings websites and returns a status
Function PingSite( myWebsite )
    Dim intStatus, objHTTP
    Set objHTTP = CreateObject( "WinHttp.WinHttpRequest.5.1" )
    objHTTP.Open "GET", "http://" & myWebsite & "/", False
    objHTTP.SetRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MyApp 1.0; Windows NT 5.1)"
    On Error Resume Next
    intStatus = objHTTP.Status
    On Error Goto 0

    If intStatus = 200 Then
        PingSite = True
        PingSite = False
    End If

    Set objHTTP = Nothing
End Function

'Sends email alerts
Function SendEmail
	Dim strCDOSchema, strCDOConfig, strCDOMessage
    strCDOSchema = ""  
    Set strCDOConfig = CreateObject("CDO.Configuration") 
    With strCDOConfig.Fields 
        .Item(strCDOSchema & "sendusing") = 2 ' cdoSendUsingPort 
        .Item(strCDOSchema & "smtpserver") = strEmailHost
    End With 
    Set strCDOMessage = CreateObject("CDO.Message") 
    With strCDOMessage 
        Set .Configuration = strCDOConfig 
		.From = strFromEmail
        .To = strToEmail 
        .Subject = strSubjectMsg
		.TextBody = strWebsite & " is down!" & vbCrLf & "Alert Type: " & strAlert
    End With 
    Set strCDOMessage = Nothing 
    Set strCDOConfig = Nothing 
End Function

Open in new window

QlemoBatchelor, Developer and EE Topic AdvisorCommented:
Can you explain why and how you "need to use F5 Token and disable proxy setting" exactly?
All Courses

From novice to tech pro — start learning today.