Attention: We are retiring the ASP.NET Community Blogs. Learn more >

Using Windows Scheduler to call an URL at specific interval

Hi,

 

I have used windows scheduler a lot of time while working with Sharepoint. Most of the time this was used to run some console application (which would work in off peak time to do some data management). But few days back, I had a requirement where by I wanted to schedule a windows scheduler to make a call to the page. The page would internally do some work on the load event.

 

But windows scheduler would not take the URL or a shortcut to the URL as a way to be scheduled. It needs an application/ batch file etc to be scheduled. So I had to think of a different way to either schedule it in windows scheduler or some other way to schedule the task of calling the web page.

 

Then with some goggle and help from friend I found a simple way to schedule calling a webpage from the windows scheduler. The solution is described below.

 

First we need to create a .vbs file. In the vbs file write the following code and save the file.


Option Explicit

Dim objIEA

Set objIEA = CreateObject("InternetExplorer.Application")

objIEA.Navigate "http://www.VikramLakhotia.com"

objIEA.visible = true

While objIEA.Busy

Wend

objIEA.Quit

Set objIEA = Nothing

 

The above code is opening an object of Internet explorer, opening the prescribed page and then also closing the internet explorer object.

 

Next create a batch file (.bat file) to execute the vbs file. Below is the code for batch file and save the file.

 

cscript.exe "FullPath_of_the_VBS_File\IE.VBS"

 

Now you can easily schedule the batch file which internally calls the vbs file and which calls the Provided URL with Internet Explorer object.

 

Regards

1 Comment

  • That's great solution when you are admin of the IIS server. I will use cscript method for intranet projects.

    But when using shared hosting, some task scheduler sites could be alternative solution.

    I use weetasks.com, it works but any ideas to schedule url calling on shared hostings?

Comments have been disabled for this content.