Skip navigation

Scheduled Tasks Follow-Up

Since my Reader to Reader article in June 2001 ("A Scheduled Tasks Tutorial"), many people have emailed me for help. I decided to follow up with an explanation of how to schedule a task and verify that the task has run, even when you're logged on as another user.

The Scheduled Task Wizard is one of Windows' most ambiguous features. The wizard evolved from the At command, and most of the procedure and documentation remained the same. The most confusing thing about the Scheduled Task Wizard is the message Enter the name and password of a user. The task will run as if that user started it. Windows 98's version of the Task Scheduler service doesn't include this message because Win98 doesn't use the At command. The At service is available only on Windows 2000 and Windows NT.

Microsoft explains the Scheduled Task Wizard in several articles. The article "How to Schedule a Program Using Task Scheduler" (http://support.microsoft.com/support/kb/articles/q178/7/06.asp) states, "To use Task Scheduler, you must log on to the computer with a valid user account." The article "Task Scheduler Service on Windows NT" (http://support.microsoft.com/support/kb/articles/q235/5/36.asp) says, "The 'logon as' field is not available for the Task Scheduler service. These credentials do not need to be configured for the Task Scheduler service because each individual task can be configured with unique credentials for the privileges required." Finally, the article "HOW TO: Schedule a Server Process in Windows 2000" (http://support.microsoft.com/support/kb/articles/q300/1/60.asp) gives a good explanation: "By default, Task Scheduler logs on as the Local System account. In some cases, this account may not have the appropriate permissions to perform the scheduled task. Because of this, you must specify an account in the Scheduled Task Wizard. Verify that the account you specify in the wizard has sufficient rights to perform the task you are scheduling by logging on as that user and running the task manually."

I've never succeeded in running a scheduled task unless I used the same username and password to schedule the task as I used when I logged on to the machine. However, you can log on with one username and password, schedule a task, log off, then log on again as another user. Your task will run at the time you specified and will appear in the log as running. But if the task requires interaction with the desktop, you won't see the task run.

To test this procedure, write a batch file that creates a directory. For example, open Microsoft Notepad and enter

c: 
cd\ 
md test 

Save the file as md.bat. Log on as an administrator or under an account that has administrative privileges. Using the same username and password, schedule md.bat to run in 5 minutes. Then, log off and log on again under another username. Start Windows Explorer, and wait for the test folder to appear in the C drive. If the folder appears, you scheduled the task correctly when you were logged on as an administrator. Your task will run in the background because it doesn't interact with the desktop. The task will appear in the Scheduled Tasks log, although the Task Scheduler might not show the task under the username you used. Whether the Task Scheduler shows the task under all usernames depends on how the Task Scheduler service is configured in Administrative Tools. The Task Scheduler service depends on the remote procedure call (RPC) service. The test folder also provides verification that the task ran.

For additional information about scheduling tasks, see Dick Lewis, Scripting Solutions: "Making a Script Work as a Scheduled Task," June 2001, and Kathy Ivens and Kenton Gardinier, "Win2K Task Scheduler," January 2001. Also, see the Microsoft articles "Task Scheduler Service Must Be Started with System Account" (http://support.microsoft.com/support/kb/articles/q223/1/70.asp) and "Troubleshooting AT Command Using /k Switch" (http://support.microsoft.com/support/kb/articles/q142/0/40.asp).

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish