Scheduled task in middle trust enviroment

September 16th, 2009 by admin Leave a reply »

Always wondered, how to run scheduled tasks on windows hosting. For example, under the Plesk control.
At the first look, everything is ok. We have scheduled task and “command line” for it. But what to write there? This is a big question.

Somebody says – no problem, I’ll write “iexplore http://example.com/track.aspx”

But I’m wondering, who closes this internet explorer process on server, and what if you are going to run this task each 5minutes?

I don’t like this way. So, where is the answer? Answer inside VB. All what we need – is to create vb script and run it inside command string.
This script creates Microsoft.XMLHTTP instance (yes, we don’t need to check anything like in AJAX deal, because we are certainly in Microsoft environment). And using this instance request your ASPX page to do all the job.

So, when I’ve asked my hosting support, how to call aspx page scheduled – they said – this impossible. Call PHP page and there request your ASPX if you want. No, thanks.

Plesk screen… to add scheduled task. “Path to executable” should be set to ABSOLUTE path to vbs file on server. Where you can get this path… First of all, you hoster should give you info about your site’s folder. If not, write a simple aspx page with Server.MapPath(”my.vbs”);

So, what inside VB file?

Download shedule.vbs (587.00 bytes)

Advertisement

Leave a Reply

Spam Protection by WP-SpamFree