In last month's Inside Out column, "Where It's AT," I described some features of the Windows NT Schedule service and the service's management tool, at.exe. Three tools in the Microsoft Windows NT Server Resource Kit and Microsoft Windows NT Workstation Resource Kit can make AT even better.
I use the Command Scheduler (winat.exe) more than any other resource kit tool. If you've used the AT command, you know that it can be frustrating to work with. You must type long strings of commands, and if you mistype one character, you have to start over. The Command Scheduler lets you use a GUI to implement the Schedule service.
The Command Scheduler lists the jobs in a computer's schedule queue, each job's ID, the day and time each job is scheduled for, and whether the job includes the /interactive option (which lets an AT program display dialog boxes and receive commands via the GUI). Double-click an item in the schedule queue, and the Command Scheduler provides a dialog box that lets you adjust the job's features. Like the Schedule service, the Command Scheduler can control schedules for every NT machine on your network.
I also frequently use the resource kit's SOON tool. If you tried to execute the examples in last month's Inside Out, you might have run into the "What time is it?" problem. Suppose I want to run a program called beep.bat that makes my computer beep. I have to look at my computer's clock and schedule beep.bat for a later time. If the computer thinks the time is 11:43 a.m. and 37 seconds, I might open a command line and type
If I press Enter before the clock hits 11:44, the computer will beep. However, if I'm not quick enough, the computer will schedule the command for 11:44 a.m. tomorrow.
The SOON tool eliminates this timing problem. It lets you schedule events for a future time, relative to the current time (in seconds). For instance, you can use SOON to schedule a beep for 1 minute from now, rather than for 11:44. SOON replaces AT, and the syntax is similar to AT's:
SOON's greatest strength is scheduling repetitive commands. For example, suppose I want my computer to beep every hour. I can write the following batch file, which I'll call beepit.bat:
soon 3600 c:\beepit.bat
I created the ^G in the second line of this batch file by holding down the Ctrl key and pressing the G key. Because I did not include a machine name, the computer I typed the command on will beep. To start the beeping, I type
from a command line. The system will beep once, and SOON will schedule the batch file to run again an hour later.
The third AT-related resource kit tool, sleep.exe, lets you schedule a program to wait for a specified period (also in seconds) before continuing. Suppose you want to schedule a backup of a computer's D drive, and you need to kick all users off the server. First, use the NET PAUSE SERVER command to keep users from attaching to the server. Next, use the NET SEND * command to notify users who are already on the server that their connection will terminate in 5 minutes. (For more information on the NET commands, see Michael D. Reilly, "NET Commands," November 1997.) Use the SLEEP command to instruct the computer to wait 5 minutes before continuing. Finally, use the NET STOP SERVER command to kick everyone off the server. Here's the command sequence:
net pause server
net send * Please get off this server. It will go down in 5 minutes.
net stop server
ntbackup d: ...
net start server
The Command Scheduler, SOON, and SLEEP are three powerful resource kit tools that I use regularly to control the NT Schedule service. Now, if only they could control my daily schedule....