strURL = "http://www.msftncsi.com/ncsi.txt" Set objWinHttp = CreateObject("WinHttp.WinHttpRequest.5.1") 'Disable redirects, option 6. objWinHttp.Option(6) = False objWinHttp.Open "GET", strURL objWinHttp.Send strStatus = objWinHttp.Status WScript.Echo strStatus strResponse = objWinHttp.ResponseText WScript.Echo strResponse Select Case objWinHttp.Status Case 200 If InStr(strResponse, "Microsoft NCSI") > 0 Then WScript.Echo "Y E S" End If Case 301 WScript.Echo "Redirect" Case 302 WScript.Echo "Redirect" Case Else 'Error End Select
Sources:
Neil Obremski's Stuff - WinHttp.WinHttpRequest.5.1
808.dk - VBScript WinHttp.WinHttpRequest.5.1 example with error handling