"Aaron" <ku*****@yahoo.com> wrote in message
news:uy**************@tk2msftngp13.phx.gbl...
Thanks Paul this works great.
I want to add one more thing
if http.Status <> "200" and does not finish downloading in 10 sec.
Do you really mean that or do you mean if the status does not = 200 **OR**
the time for the head request to return is greater than 10 seconds? The
script below assumes my interpretation.
If you really mean your way then change this line
if http.Status <> "200" or DateDiff("s", StartTime, EndTime) > 10 then
to
if http.Status <> "200" and DateDiff("s", StartTime, EndTime) > 10 then
'CheckServer.vbs
URL =
http://localhost
CMD = "cscript c:\inetpub\adminscripts\iisrestart.vbs"
Set WshShell = WScript.CreateObject("WScript.Shell")
on error resume next
Set http = CreateObject("Microsoft.XmlHttp")
http.open "HEAD", URL, FALSE
StartTime = Now
http.send ""
EndTime = Now
if http.Status <> "200" or DateDiff("s", StartTime, EndTime) > 10 then
WshShell.Run CMD
end if
set http = nothing
set WshShell = nothing