Call a webpage with VBScript for Scheduled Task

I did use a custom app which read a text file containing a list of URLs, but for some reason this didn’t work as a Scheduled Task despite setting the work directory. So I resorted to this handy vbscript which worked a treat.

Call ViewURL()
Sub ViewURL()
        On Error Resume Next
        Dim objReq
        Dim URL
        Set objReq = CreateObject("Microsoft.XMLHTTP")
        URL = "http://www.google.com" 'Change this as required
        objReq.open "POST", URL , false
        objReq.Send
        Set objReq = Nothing
End Sub

Just save this code in a .vbs file “mytask.vbs”. Navigate to “Task Scheduler” in
Program Files>Accessories>System Tools>
and follow the on screen instructions.

If you want the task to run even when the user is not logged in, then make sure you check the “Run whether the user is logged in or not” option and the user account running the task has sufficient privileges – ideally don’t just use the admin account.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.