Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


March 1998

Where It's AT


RSS
Subscribe to Windows IT Pro | See More Performance Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

NT's underused Schedule service

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

beep

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

at

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 tardis@kaska.demon.co.uk 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.)

End of Article



Reader Comments
I enjoyed reading Mark Minasi’s March Inside Out column, “Where It’s AT,” and found it most useful. However, I would like to comment on the beep.bat program. In a DOS window, using the edit program or using Notepad, holding down the Ctrl key and then pressing G does not produce the ^G symbol. This symbol appears only when you follow that process at a command prompt. Any suggestions as to why?<br>
--Rizwan Alam<br><br>

<i>I received several similar letters about this problem; sorry to anyone the article confused. I was using an old trick that’s been around since the DOS 1.0 days: copy con. It works like this:<br>
1. Type</i> <br><br>

copy con beep.bat<br><br>

<i>and press Enter.<br>
2. Type </i><br><br>

@echo off<br><br>

<i>and press Enter.<br>
3. Type</i><br><br>

echo ^g<br><br>

<i>(the Ctrl+G sequence) and press Enter.<br>
4. Then, either press F6 and Enter or Ctrl+Z and Enter.<br>
5. You’ll see the message 1 file(s) copied.<br>
I don’t know how to enter control characters in Notepad.<br>
--Mark Minasi</i>

Rizwan Alam August 10, 1999


I just finished reading Mark Minasi’s March Inside Out column, “Where It’s AT.” I had to implement a nightly service restart mechanism, and I ran into a problem that the article didn’t address. The Windows NT Online Help for AT states that if you want to run anything other than an executable, you need to do it via the cmd.exe /c command; that is, you must pass a command to run the command processor. Among the examples Online Help provides, some are in the form “cmd.exe /c file.cmd > out.txt” (double-quotes included).
If you enter a command as shown in the examples, an error occurs when the Schedule service tries to run the command. The double-quotes preceding cmd.exe prevent NT from finding the executable. Only marginally helpful errors show up in the System Log.
What worked for me is to enter the command with double-quotes after the cmd.exe /c portion of the command and at the end:<br><br>

cmd.exe /c “file.cmd > out.txt”<br><br>

I wanted to pass along that tip. Thanks for a great magazine.<br>
--Donnie Hale

Donnie Hale August 10, 1999


Fair article, but no mention of the thorny issue of scheduler runtime privileges. Any way of setting AT to impersonate a user when running scheduled jobs? I am assuming that AT defaults to impersonating the administrator that set the job up... is this wrong?

James McCormack February 11, 2000


Excellent information!!!!!!!!!!!

Scot Jones June 13, 2001


Great contribution about AT!
Is there anyone who found out how to schedule to run a command ON THE LAST DAY OF EVERY MONTH?
I NEED that :-)

Thanks,


Frank Jacobs February 05, 2002


I wannted to know the that How much syntax I can use with AT commands, please give me Syntax List.

Farhan Notta December 19, 2002


Doesn't Tuesday = T (not Tu) and Saturday = S (Not Sa)

Mass December 10, 2003


Can you schedule a task to run every minute using AT?

Preethi May 18, 2004


Actually, you can use Sa for saturday, but you can NOT use Tu for tuesday [well, at least from WinXP SP1 (Version 5.1.2600)]

Mike Malburg July 06, 2004


many years later still valuable information. thanks!!

Anonymous User February 25, 2005


You must log on before posting a comment.

If you don't have a username & password, please register now.




Top Viewed ArticlesView all articles
Friday at PASS Europe 2006

Kevin talks about the closing day of the event and shares a funny Microsoft film. ...

More fun TechEd 2005 Resources

Kevin points out some more TechEd resources ...

What service packs and fixes are available?

...


Windows OSs Whitepapers Why SaaS is the Right Solution for Log Management

Are You Satisfied?

A Preliminary Look at Deployment Plans for Microsoft Windows Vista

Related Events Check out our list of Free Email Newsletters!

Windows OSs eBooks Understanding and Leveraging Code Signing Technologies

A Guide to Windows Certification and Public Keys

SQL Server Administration for Oracle DBAs

Related Windows OSs Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.

Job Openings in IT


ADS BY GOOGLE SPONSORED LINKS FEATURED LINKS

Microsoft Exchange & Windows Connections event returns to Las Vegas Nov 10 - 13
Connections returns to Las Vegas for this exciting event where each attendee will receive SQL Server 2008 standard with 1 CAL. Co-located with Microsoft ASP.NET, SQL Server, and SharePoint Connections with over 250 in-depth sessions.

Free Online Event! Virtualization:Get the Facts!
Register now and attend this free, live in-depth online conference on November 13 and 20, 2008, produced by Windows IT Pro. All registrants are eligible to receive a complimentary one-year digital subscription to Windows IT Pro (a $49.95 value)!

Check Out Hyper-V Video on ITTV
Watch Karen Forster's interview on Hyper-V's performance on ITTV.net.

Ease Your Scripting Pains with the Flexibility of PowerShell!
Join MVP Paul Robichaux on December 11, 2008 at 11:00 AM EDT as he equips you with PowerShell basics in 3 introductory lessons, each followed by a live Q&A session—all on your own computer!

Latest Advancements in SSL Technology
There are a variety of different kinds of SSL to explore to ensure customer data is kept confidential and secure. In this paper, we will discuss some of these SSL advances to help you decide which would be best for your organization.

PASS Community Summit 2008 in Seattle on Nov 18-21
The don’t-miss event for Microsoft SQL Server Professionals. Register now and you’ll enjoy top-notch Microsoft and Community speakers and more.



Solving PST Management Problems
In this white paper, read about the top PST issues and how to administer local/network PST Files.

Get Protected -- Data Protection Manager 2007
Protect your virtualized environment with Data Protection Manager

Order Your SQL Fundamentals CD Today!
Learn how to use SQL Server, understand Office integration techniques and dive into the essentials of SQL Express and Visual Basic with this free SQL Fundamentals CD.

Maximize Your SharePoint Investment: Get Your Data Moving
Watch this web seminar now to learn how to maximize your SharePoint investment! Join us as we take a look at the complex business of securing, accessing and managing vast amounts of information in a global network and various ways to get your data moving.
Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2008 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing