Over the past month, I've learned some new tricks in Windows NT's Schedule service. The Schedule service lets you enter commands that you want executed in the future: at a later time, on a later date, or even on a regular basis. The program is simple to use, and it's a great resource for NT administrators.
To use the Schedule service, you have to turn it on: Open Services in the Control Panel, select Schedule, and click Start. To set the Schedule service to start automatically every time you turn on your computer, double-click Schedule and select Automatic.
You'll use at.exe to enter, delete, and view jobs in the Schedule service. To give you an idea of how the Schedule service works, let's make your computer beep at a specified time. NT doesn't have a command-line program that produces beeps, but you can create your own with a two-line batch file. Call it beep.bat and make it look like this one:
@echo off echo ^G
When you type the second line, you don't type a circumflex (^) and a G. You hold down the Ctrl key and press G, and ^G will appear. Make sure beep.bat is on your NT path. To test the file, open a command line and type
The system will emit a beep.
Next, check the time according to your computer. Right now, my computer thinks the time is 11:43 a.m. and 20 seconds. Tell your system to beep on the next minute--11:44 in my example--by typing
at 11:44 beep.bat
Your system will respond with a message such as Added a new job with job ID=1. When the clock rolls over to 11:44, your computer will beep.
The computer uses military time, so if you want the computer to beep at 3:30 p.m., you must issue the command for 15:30. If this AT command doesn't work, you have one of the following problems: You haven't put beep.bat on your system's path, the Schedule service isn't turned on, or the clock rolled over to 11:44 before you finished entering the command (in which case, the computer queued up the beep for tomorrow).
You can view the items in your computer's Schedule queue. From the command line, type
The Schedule service will show you upcoming jobs and job IDs. You can use the job IDs to delete unwanted jobs from the queue. For example, if your beep command is still in the queue, and Schedule has assigned the command job ID 17, you can tell the computer to forget about it by typing
at 17 /delete
You can use the /delete /yes option to delete all the jobs in the Schedule queue.
The Schedule service works with NET SEND commands, too. I am writing this on Thanksgiving Day, and I have a turkey in the oven that I must baste at 1:30 p.m. I can type
at 13:30 net send ultraii Time to baste the turkey!
to program the Schedule service to remind me to baste my turkey. (See "Knowing the Angles of NetBIOS Suffixes," February 1997, for details about NET SEND.) NET SEND commands send a pop-up message to either a computer or a user. I'm working on a machine named ultraii, so I wrote the AT command to send the message to ultraii. I could also have sent the message to MarkJM, the username under which I'm logged on. Several external tools perform similar functions, but the Schedule service is a handy alternative. Think of the service as a sort of Schedule Minus.
AT can do much more than serve as a cooking timer. You can use the /every: option to have AT perform a function every day at a particular time. For example, if I have a batch file named fbackup.bat that contains the commands my system needs to start a full backup, I can tell AT to execute the backup every Wednesday at 3:00 a.m. with the command
at 3:00 /every:Wednesday fbackup.bat
AT won't swap tapes around for you (at least not yet--NTBACKUP under NT 5.0 will support robotic tape changers, but NTBACKUP under NT 4.0 doesn't), but this simple program provides most of the scheduling functions administrators need. Vendors always amaze me when they promote a product as the best possible backup program for NT, yet they advertise a scheduling program as one of the product's features. Such marketing suggests to me that the product is just a warmed-over application from another operating system.
At my company, we did our backups with two AT commands. We did a full backup every Wednesday morning and differential backups every other night. For the differential backups, we used the command /every:Su,M,Tu,Th,F,Sa. Notice the abbreviations AT can take: Su, M, Tu, W, Th, F, and Sa. Oddly, AT accepts commands using the abbreviations T and S, but the system doesn't know what to do with them. The Schedule service never executes jobs assigned to T or S; they just remain indefinitely in the queue.
You can also schedule events for particular days of the month. The command /every:1 will schedule a job for the first of every month. Unfortunately, you can't use the Schedule service to execute commands on the last day of every month. (I've always thought a calendar with 13 months of 28 days each and a free day at the end of every year would make life easier for us computer people.)
Another important option in the Schedule service is the /interactive option. To execute differential backups, my company used the command line
at 3:00 /every:Su,M,Tu,Th,F,Sa /interactive dbackup.bat
This simple service provides some of the same functionality as complex scheduling products.
Schedule service programs don't run on the desktop, where users can execute or even see them; they run in their own session. NTBACKUP can't report an error message or ask you to change a tape if you don't use the /interactive option. For example, try to run an interactive program such as the User Manager (either musrmgr.exe, the version that ships with NT Workstation, or usrmgr.exe, the User Manager for Domains that ships with NT Server) without the /interactive option. From your workstation, if you type
at 12:45 musrmgr.exe
you'll hear the hard disk click for a second or two at 12:45, but you won't see the User Manager windows. Try the same command again with the /interactive option, and the program will work fine.
Another interesting feature of the Schedule service is a time service application. If you want all your computers to register the same time, you must implement a synchronization routine. First, make sure that at least one machine on the network always keeps the right time. At my company, we set up one computer to keep the correct time using a shareware program called Tardis95. (You can email Tardis95's creator, H. C. Mingham-
Smith, at email@example.com for details about finding a copy. The program costs $20 to register and is well worth the price.)
After you've set up a computer with reliable time, you can make that computer an NT time server by poking around in the Registry. Go into HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanManServer\Parameters, and add a new value entry called TimeSource of type REG_DWORD. Set TimeSource to 1. Any machine in your NT time server's workgroup that executes a
net time /set /yes
command will synchronize its time with the NT time server. Then set up the Schedule service to have your computers correct their time daily by entering the command
at 1:00 /every:M,Tu,W,Th,F,Sa,Su net time /set /yes
You don't have to enter this command manually on each machine. If you are an administrator for a remote workstation named louie, and if louie's Schedule service is on, type
at \\louie 1:00 /every:M,Tu,W,Th,F,Sa,Su net time /set /yes
on any networked NT machine to kick off a time synchronization on louie.
I know the Microsoft Windows NT Server Resource Kit now includes a time service, but it hasn't always. And in case you're wondering, NET TIME understands time zones. This simple service provides some of the same functionality as complex scheduling products. Some of the best resources in NT are free. (See Michael Reilly, "NET Commands," November 1997, for related information.)