Subscribe to Windows IT Pro

 

Get Newsletters

  • Get the Latest News
  • Product Updates
  • Helpful Tricks
  • Productivity Tips

Subscribe Now!

December 19, 2001 12:00 AM

Scheduled Tasks Follow-Up

Windows IT Pro
InstantDoc ID #23164
Rating: (1)

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).

Related Content:

ARTICLE TOOLS

Comments
  • Anonymous User
    7 years ago
    Aug 23, 2005

    The standard log for scheduler is "SchedLgU.Txt" (in win2k, I'm not sure about XP, but it is probably the same). Using the log file should give you a much more detailed description of the problem with your schedule.
    -Gideon.

  • Anonymous User
    7 years ago
    Feb 22, 2005

    My scheduled tasks say "could not start". I have tried many things. I have windows xp home edition. Can anyone help. I'm so frustrated.

  • ryan
    8 years ago
    Jun 05, 2004

    I wrote a simple batch file to run a URL that triggers a radio station to run in Media Player. But whatever I try to get Scheduled Task to execute it fails. Including from Administrator with all the correct PW settings etc.

    It really drives me crazy not being able to get such a simple function to work.

    Any help will be utterly appreciated.

You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

White Papers

Get your Windows 7 deployment off to the right start by implementing PC lockdown. A locked-down environment is easier and cheaper to support since users are less likely to make unnecessary changes to the core system configuration - read more here!

Essential Guides

Is your iSCSI "lossy"? The reality is that most off-the-shelf Ethernet hardware deployed for iSCSI can lose packets, resulting in slow performance or application downtime. Learn how to assess your current iSCSI infrastructure and engineer an advanced iSCSI SAN infrastructure.

Web Seminars

What's the best way to keep your network safe from malware? In this web seminar, security expert Greg Shields suggests an alternative method to the traditional blacklisting approach that is common with anti-virus and anti-malware solutions.

eLearning Series

We bring the experts direct to you to share their real-world perspective and expertise. During each event, three sessions stream in real time, so you can learn, ask questions, and get solutions.
Upcoming event: Getting the Most with Exchange 2010 with Paul Robichaux

Subscribe to Windows IT Pro!

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.