Importing Multiple Scheduled Tasks from Windows XP/Server 2003 to Windows 7/Server 2008

Windows Server logo

On Windows XP and Windows Server 2003, Scheduled Tasks are stored as binary files with the “.job” extension. They are also stored in this manner on Windows Server 2008. Also, the jobs are stored in the same location in both operating systems, namely, “C:WindowsTasks”. So if you want to copy jobs from one to the other, you should just be able to copy the files, right? No, that would be too easy. For whatever reason, Microsoft chose to make it much more difficult to migrate jobs than this.

To successfully import jobs, several steps are required.

First of all, copy all “.job” files on the XP/2003 box into a folder of your choosing on the 2008 box. I’ll create “C:temptasks” for this example.
Next, copy two files – schtasks.exe and schedsvc.dll – from C:WindowsSystem32 on the source box into the C:temptasks folder on the destination box.
Thirdly, copy (don’t move) the job files from the C:temptasks folder into the C:WindowsTasks folder on the destination box.

Now for the fun part. To import a job, the following command must be issued from the Command Prompt:
schtasks /change /TN <<Scheduled Job Name>> /RU <<Username>> /RP <<Password>>

This command will only import one job – the one with whatever name you put in the command.  If you have many jobs to import, this will not be practical.  You’ll need a script to do this, but fortunately the script is simple.

By using a for loop and a basic regular expression, this can be done at the command line:

c:temptasks>FOR /R . %F in (*.*) do schtasks /change /TN “%~nF” /RU <<Username>> /RP <<Password>>

This will import all of your job files into the Task Scheduler. The tasks may be in an enabled state, so be sure to check this if you don’t want them to run yet.