Launching Web+Center code with Windows Scheduler

Posted on November 5, 2018 by · Posted in Uncategorized

Web+Center is 100% web-based and it can appear that the only way to execute the code is by a human operator opening up a browser and logging in and performing an operation with the mouse and keyboard.  Once you understand how to launch the browser with a specific URL and the query string parameters, you can often run Web+Center code in the background like a windows task with some simple customizations.  Using the Windows Scheduler, you can launch tasks on a scheduled, repetitive process.

It will often take some careful reviewing of Web+Center code, the ASP page code calling parameters and adding simple code customizations to bypass the Web+Center tech or customer login in security mechanisms.

Browsers executables can will typically take the web URL as a parameter like:
(chrome)

C:\>"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" "https://aaa.com"

OR
(Internet Explorer)
c:\program files\internet explorer\iexplore.exe “http://localhost/tech90/updatetodaykb.asp?NextRecordCount=0&pw=pass

Many of the Web+Center pages are called with Query string parameters and those can be defined on the browser command line when launching the browser and URL with the scheduler.

Bypassing Web+Center logged in user security
Almost every Web+Center ASP code module has a tech or customer authentication security check at the beginning of the module.  IF you attempt to run a Web+Center page that requires this security check to verify logged in user credentials with the scheduler, it will fail.  To get around this, you can add a these few lines to the  security section of any Tech+Center module of:

‘ Allow access if passed special password as query which is configurable and coded below
defaultpw =  “snowball”
pw = Request.querystring(“pw”)
If pw = defaultpw then
ValidUser = “YES”
End If

To make this work, on your calling set of parameters, you would  add the query string of pw=snowball in the example of:

http://localhost/tech90/somepage.asp?pw=snowball

This will only allow this one page to run after you customize that ASP module with the correct password.  This code will still allow the module to function the same when called by a logged in tech or customer user.

Configuring the Windows Scheduler to run the code
We recently created a new Web+Center ASP script designed to run in the background called UpdateTodayKB.asp.  This script parses and updates the knowledge base from any tickets that were modified that day.  This script is designed to be run from the scheduler and it takes query string parameters.  The calling format of the module is:
UpdateTodayKB.asp?NextRecordCount=0&pw=pass

Here are the steps to configuring this module to run with the Windows Scheduler as an example.  This module is a new module created in October 2018 so if you want to run this module, please download it from our Web+Center Version 9.0 version server HERE.

Step 1) Launch the windows scheduler by entering Task Scheduler into the run menu search box in the lower right hand corner

Step 2) Select the Action menu and click on the Create Task option


In the Name box enter DailyKBUpdate
In the Description box enter the text:
This will parse and update the KB with any cases updated today.
Select the Run whether user is logged on or not checkbox
Select the Run with Highest Privileges checkbox
Configure for: Your current OS you are hosting Web+Center on (Windows 7, 10, 2008, etc)
Click OK
Step 3) Click on the Triggers tab

Press the New button
Select the default on a schedule option
Select the daily radio button
Set the Start time to something like 11:30 PM
Leave default enabled checked
Click OK
Step 4)  Select the Actions tab

Press the New button

Select the action – Start a program
In the program script enter**:
“c:\Program Files\Internet Explorer\iexplore.exe”
** If you have another browser you want to run, browse to that browser exectutable instead
In the add arguments box enter***:
http://localhost/tech90/updateTodayKB.asp?NextRecordCount=0&pw=pass
***Your URL string might be different if you are running a different version of Web+Center or you have customized the default special login password pw in the ASP file or if you are scheduling this task from another machine besides the server itself.
Click OK
Step 5) Click on the Setting tab


Configure the settings with the checkbox  and dropdown that says Stop the task if it runs longer than 1 hour
And set the dropdown that says
If the task is already running, then the following rule applies
Stop the existing instance

Press OK to save the settings
Note: We are stopping the task since the browser won’t close  by itself.  It is not that is really running and crunching away and accessing the database, the browser is just sitting in it’s static screen mode.

Testing your DailyUpdateKB task

To confirm that your task is properly configured, click on the Task Scheduler Library.  You can also test run your scheduled task by showing the Task Scheduler Library and finding the DailyKBUpdate task and right mouse click on the event and select the RUN option.

Conclusions:

Feel free to give our friendly support staff a call if you have any questions with using this feature or need to discuss other Web+Center customizations.  We are wrapping up design and implementation changes for Web+Center Version 10.0 so if you have new customizations requests and wish to have those implement for V10, please email us your required changes soon!

If you are looking to upgrade your Web+Center or wish to migrate your Web+Center to a newer Windows OS or even move your Web+Center install to a VPS (Virtual Private Server) , we are here to help!  We assist Web+Center users daily with important and carefully planned migrations to limit any upgrade risk or prevent any outage of your production support system.  We understand the importance of your mission critical system of support with Web+Center so we design our upgrade process to not touch your current production system.