Here are steps to get started.
The script makes an HTTP request to a webpage on a timed basis. (i.e. every 5 minutes).
YourVBScript.vbs
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("Microsoft.XMLHTTP")
'Put together the URL link appending the Variables.
URL = "http://www.YourDomain.com/Testlog.aspx"
'Open the HTTP request and pass the URL to the objRequest object
objRequest.open "POST", URL , false
'Send the HTML Request
objRequest.Send
'Set the object to nothing
Set objRequest = Nothing
End Sub
Testlog.aspx webpage
<%@ Page Language="VB" AutoEventWireup="false" codefile="Testlog.aspx.vb" Inherits="Testlog"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Log Page</title>
</head>
<body>
<form id="form1" runat="server">
<div></div>
</form>
</body>
</html>
Testlog.aspx.vb code behind
Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration
Partial Class Testlog Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
‘Put your code in that would process when Testlog.aspx is request
Response.write(“Testlog.aspx was called:” & System.DateTime.Now())
End Sub
End Class
How to schedule a task using Windows Task Scheduler
A scheduled task will allow a person to schedule any script, program, or document to run. Scheduled Tasks run at the time specified which could be multiple times per minute, hour, or day.
- Write your VBS Script
- Develop the webpage to process the HTTP Request
- Schedule the VBS Script
- Write your VBS script
The script makes an HTTP request to a webpage on a timed basis. (i.e. every 5 minutes).
YourVBScript.vbs
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("Microsoft.XMLHTTP")
'Put together the URL link appending the Variables.
URL = "http://www.YourDomain.com/Testlog.aspx"
'Open the HTTP request and pass the URL to the objRequest object
objRequest.open "POST", URL , false
'Send the HTML Request
objRequest.Send
'Set the object to nothing
Set objRequest = Nothing
End Sub
Testlog.aspx webpage
<%@ Page Language="VB" AutoEventWireup="false" codefile="Testlog.aspx.vb" Inherits="Testlog"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Log Page</title>
</head>
<body>
<form id="form1" runat="server">
<div></div>
</form>
</body>
</html>
Testlog.aspx.vb code behind
Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration
Partial Class Testlog Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
‘Put your code in that would process when Testlog.aspx is request
Response.write(“Testlog.aspx was called:” & System.DateTime.Now())
End Sub
End Class
How to schedule a task using Windows Task Scheduler
A scheduled task will allow a person to schedule any script, program, or document to run. Scheduled Tasks run at the time specified which could be multiple times per minute, hour, or day.
No comments:
Post a Comment