5/8/2013 5:33:30 PM

The following code will make a GET request to a url. This can be used in conjuction with Windows Task Scheduler to ping a website every couple of minutes to ensure the IIS worker process stays alive. This is easier than creating a Windows Service to do this.

Task Manager doesn't seem to like these vbs files. I found creating a separate .bat file works better. Create the .bat file, and have the Task Manager call the bat file. The contents of the .bat file are below.

Call LogEntry() Sub LogEntry() 'Force the script to finish on an error. On Error Resume Next 'Declare variables Dim objRequest Dim URL Set objRequest = CreateObject("MSXML2.ServerXMLHTTP.6.0") 'Open the HTTP request and pass the URL to the objRequest object and Send objRequest.open "GET", "http://www.example.com/" , false objRequest.Send 'Set the object to nothing Set objRequest = Nothing End Sub //.bat File cscript.exe //Nologo "C:\Service Path\Tasks.vbs" > "C:\Service Path\output.txt" 2>> "C:\Service Path\errors.txt"