Way to import a scheduled task from windows 2003 (.job) to windows 2008 (.xml)

scheduled-taskwindows-server-2003windows-server-2008

I had some jobs to be moved from the old production server (windows 2003 server standard) to the new machine (windows 2008 server standard), but the new server is unable to read the old .job format, also the import wizard only imports from .xml job files (same version). Obviously I don't want to rebuild all the jobs by hand, but can't find a tool that makes the process a very little easier. I don't trust in Microsoft for this kind of tools, my previously experiences had been to bad (DTS -> SSIS). Any ideas?

Thanks in advance.

Best Answer

Looks like they were discussing the problem here: http://social.technet.microsoft.com/Forums/en-US/itprovistamigration/thread/76b6276b-49f2-41e2-b4ea-f537e0eb88a8

Seems like there is no current approved method of doing this.

However one user in that forum posted this:

If you run schtasks from the vista/2008 server maching you can export the xp/2003 schtasks to xml. schtasks /query /s xpmachine /tn taskname /XML > taskname.xml then you can import it. not perfect but can save time. i exported the tasks using /fo table opened that to excel deleted unneeded columns and created a batch file to dump the xmls then /create /xml xmlfile.xml to import the xmls to the new server. hope this helps.

So it seems possible but it needs some jiggery pokery.

I tried it out myself but kept on getting access denied errors from Win2008. Even though I was the network admin with all privileges. Maybe someone else could make an attempt?

EDIT-Solution:

Where you got your job files was probably c:\windows\tasks, however under Vista there is a new place the xml files exist. (Under c:\windows\system32\tasks) Try looking there on your old machine if possible.

HOWEVER, there is a way if you can't get to the original machine easily.

  • You will need 2 files off an XP machine (Schtasks.exe and Schedsvc.dll) they are both in the Windows\System32 folder, copy them to USB and thats all you need from XP.
  • Now on your Vista machine. Put them in their own directory on your vista machine (lets say you make a directory called c:\sch and put those 2 files in there) DO NOT overwrite the vista ones in c:\windows\system32.
  • Rename your job files Test1.job, Test2.job, Test3.job, Test4.job and copy them into c:\windows\tasks
  • Open up a command prompt (Start Programs, Accessories, right click on Command Prompt and select run as administrator)
  • Now to touch over the new .job files to get vistas scheduler to take on the parameters.
  • In your command prompt
    type in cd c:\sch then enter (for our example)
  • Now for each job type in schtasks /change /TN "Test1" /RU Terry /RP Terry (Changing the Test1 to Test2, Test3, Test4 for our example) The /RP and /RU values will have to change, thats a username and password (RP being password, RU Being User)
  • You should receive the message SUCCESS: The parameters of scheduled task "Test1" have been changed. for each job.

When done close your command prompt. From there Windows scheduler now knows about these, and you can use the windows Gui to update their names, and who they run as.

I have tried this personally and yes it does work. It would only take a little more effort to script it. You just need to leave the xp files on the vista machine. You could then export them as XML via script as well.

Link: From experts exchange