Scheduling Script

Download Here  >>> Click to download   

    This scheduling script is useful in situations where you have several programs you need to launch on a schedule, but you don't want to go through the password-changing hassle of using the task manager to launch them all. If you set the task manager to run with your user name and password, then it will launch this script with your credentials. Likewise, programs launched by this script will run with your credentials. If you had 50 programs to schedule and ONLY used the task manager, you'd have to re-enter your password 50 times when your password changed. Using this script means you only have to change it once.

    Set up the task manager to launch this script. Use a command line like:
C:\WinNT\System32\wscript.exe "C:\Foo\Schedule.vbs"
After it is set up, go back and change the time so it runs every 5 minutes when idle. That way, if the computer reboots, the scheduler will start up after five minutes. Likewise, if the scheduler script crashes, it would be automatically restarted after 5 minutes. If you don't like my five minute suggested time, the "idle time" can be set as short as 30 seconds or as long as you want. Or you could have it ONLY run at system boot up.

    Multiple instances of the script are blocked, so it's safe to have your task manager or other brain-dead program try to restart the script whether it needs restarting or not! A side-effect of the blocking method is that you must wait 25+ seconds to re-start the script after you stop it. That should only be a problem during testing. If you really do want to have multiple instances of this scheduling script running, just give them different names. Each differently-named script will create and use it's own database.

    This script launches programs, scripts, and batch files according to schedule entered in a matching Access database. It will create the matching database (if needed) the first time it runs. Fairly obviously, you should have Microsoft Access on your system so you can edit the database and create new entries. However, as long as you have MDAC and the Microsoft "Jet" drivers installed on your computer:
... you should be able make new entries with a custom script or an ODBC connection from another database program. Of course, since this script uses those same Jet/MDAC drivers, you MUST have them on your computer in order for the script to work!

    An advantage of being a script is that even on a locked-down corporate computer where you couldn't install a "real" scheduling program, you can probably install this script. Another advantage is that this is ONLY A SCRIPT! Which means you can edit it, look at it, and see that there are no tricks involved. If you're a programmer, you can even modify the code so it works better for your particular situation.

    An advantage of using the Access database format is that your other admin scripts can easily add new things to the schedule by using the normal data access code you're probably very familiar with.

    The database created by the script is an Access 2000 database, so you'll need Access 2000 or later to read and modify it. If you have an older version of Access, you can change the version of database that gets created by modifying the TWO lines in the script which contain this text:
Set dbeng = CreateObject("DAO.DBEngine.36")
The "36" is for Access 2000, and changing the lines to use "35" will result in the use of Access 97 databases. If you have an even *older* version of Access, try lowering the number or leaving it off entirely:
Set dbeng = CreateObject("DAO.DBEngine")

    Just in case you have Access 97 and don't want to modify the script, I've included an Access 97 database for you. You don't have to modify the script to USE an older database version, so even though the script is set for Access 2000, it will work fine on the included Access 97 version.

    Note: Database Month value is STRING, for example, use July, not 7. In all cases with numbers, DO NOT use leading zeros. You can use comma-delimited sets. For example, for a script that runs at 7AM and 5PM on weekdays, set the "Weekday" value to:
... and set the "Hour" value to:
Yes, that's "military" 24-hour time.

    The database and script assume a blank field is TRUE for all cases. So if you entered just the following:

Description    Notepad
CommandLine    "C:\WinNT\System32\Notepad.exe"

... then Notepad would start up once a minute. Which you don't want unless you're just testing a command line. If you used these entries:

Description    Notepad
CommandLine    "C:\WinNT\System32\Notepad.exe"
WeekDay        Monday,Tuesday,Wednesday,Thursday,Friday
Hour           8
Minute         0

... then Notepad would only start at 8AM on weekdays. 

If you've got a decent budget for a standalone task scheduler and you're looking for something more powerful, you might want to look at AutoMate from Network Automation. AutoMate can trigger on anything (system log entry, cpu load, time, window appearance, file modification, etc.). Most other schedulers (like my script here) only trigger based on time. AutoMate can do almost anything once it's been triggered, and the coolest thing is it's all handled through a nice graphical interface with no programming

System administrators neeed more power than the built-in Windows task scheduler offers. Now they can have that power without having to beg the programmers to set something up for them. 

Is AutoMate the only tool out there that does this? Beats me. It's just the only one I know of.

Lost? Look at the site map.

Bad links? Questions? Send me mail.

Ask Jeeves