WindowsDevCenter.com
oreilly.comSafari Books Online.Conferences.

advertisement


AddThis Social Bookmark Button

Copy Scheduled Tasks to Remote Machines

by Mitch Tulloch, author of Windows Server Hacks
05/10/2005

Scheduling tasks on a Windows machine can be done at the console in several ways:

  • Using the Scheduled Tasks wizard, which is accessed by Start -> All Programs -> Accessories -> System Tools -> Scheduled Tasks folder -> Add Scheduled Task.
  • Using the schtasks.exe command-line utility in Windows XP and later.
  • Using the legacy at.exe command-line utility in Windows 2000 and later.

None of these tools, however, provides an obvious way of scheduling a task on a remote machine. For example, let's say you've got a home network with one machine in the basement and another in the attic, and you're in the basement and want to schedule a backup for the machine upstairs. Running upstairs and doing that at the local console of your attic machine might be just the exercise you need to help you burn off some of your "geek roll," but on the other hand you might have a heart attack, so there's got to be a way to do it remotely, right? Well, if you have Remote Desktop enabled on your attic machine, then it's easy. But what if for security reasons you don't?

Fortunately, where there's a will, there's a way. Let's say we want to schedule a task on a remote computer named Testbox, and we want to do this using the local computer named Desk44. First log on to Desk44 and open the Scheduled Tasks folder using the procedure described earlier in this article.

Figure 1
Figure 1. Scheduled Tasks folder on a local machine

Next, double-click on Add Scheduled Task to start the Scheduled Task Wizard, and walk through the wizard to schedule the task you want to run on the remote machine. Pay special attention to the step where you specify credentials for the task to run under, because these credentials must be valid on the remote machine.

Figure 2
Figure 2. Specify credentials for the remote task

Note that if the credentials you specify are valid on the remote machine but not the local one, you'll get a warning message at the conclusion of the wizard. However, you can ignore this because you want the task to run only on the remote machine. Note also that after you create the task it may not show up in the local Scheduled Tasks folder until you refresh the folder by pressing F5.

Now copy the task you created to the remote machine Testbox. Open My Network Places and browse the workgroup (or domain if you have one) until you find the remote machine.

Figure 3
Figure 3. Desk44 and Testbox in Workgroup

Double-click on the remote machine (Testbox), supplying the credentials it can accept if necessary, and you'll see the Scheduled Tasks folder on it (as well as any shared folders or printers for that machine).

Figure 4
Figure 4. Scheduled Tasks folder on the remote machine

Double-click on the remote Scheduled Tasks folder to open it, and then drag your task from the Scheduled Tasks folder on the local machine to the Scheduled Tasks folder on the remote machine.

Figure 5
Figure 5. The backup task created locally has been copied to the remote machine

If desired, you can right-click on the task on the remote machine and edit its properties as needed. If for some reason the task doesn't run when scheduled, open the Scheduled Tasks folder on the remote machine and select View Log from the Advanced menu item. This will display the contents of the Schedlgu.txt log file found in the %SystemRoot%\Tasks folder on the remote machine, and it can be a great help in troubleshooting why tasks don't run as expected. You can also select View -> Details in the Scheduled Tasks folder to quickly see the status of your task.

Mitch Tulloch is the author of Windows 2000 Administration in a Nutshell, Windows Server 2003 in a Nutshell, and Windows Server Hacks.

Windows Server Hacks

Related Reading

Windows Server Hacks
100 Industrial-Strength Tips & Tools
By Mitch Tulloch

Return to the Windows DevCenter.