Views:

Using the Plesk Windows Scheduler to call an ASP or .NET page

Issue

You would like to use the Plesk Windows Scheduler to call a particular ASP or ASP.NET script on your web site that will perform a function.

Solution

1. Click on 'Scheduled Tasks' in Plesk

2. Click on 'Add New Task'

3. Enter a description and notification email if required

4. In the 'Path to executable file' field, enter the following path: C:\Windows\system32\cscript.exe

5. In the 'Arguments' field enter the following: D:\vhosts\mysite.co.nz\httpdocs\schedule.vbs  (replacing mysite.co.nz with your domain name)

6. Because cscript.exe won't execute an asp file, we'll need to create a vbs script, that will then call the asp script. In the schedule.vbs script, we'll use the xmlhttp request to open a web page. Copy and paste the script below and save to a file called schedule.vbs and upload this to your site.

Call RunIt()
Sub RunIt()

Dim RequestObj
Dim URL
Set RequestObj = CreateObject("Microsoft.XMLHTTP")

'Request URL...
URL = "http://www.mydomain.co.nz/myScript.aspx"

'Open request and pass the URL
RequestObj.open "POST", URL , false

'Send Request
RequestObj.Send

'cleanup
Set RequestObj = Nothing
End Sub

7. Now you can create your myscript.aspx page, or whatever you would like to name it to perform the tasks you require to be scheduled.

Get in touch

For any additional help, give us a call on 0800 477 333 (8AM to 10PM, 7 days a week).