How to export Scheduled Tasks configuration
I'm running Windows 2012 R2 Server and I run a lot of Scheduled Tasks. I am afraid that in case something would happened to server and I should create another server I won't be able to restore those Tasks. Hence here's my question: Could I somehow safe or better export Scheduled Tasks configuration in order to restore it on the same or another server? Thanks
Solution 1:
How can I export Scheduled Tasks in order to restore them on the same or another server?
The other answer suggests exporting them one by one. There is a slightly easier method:
All the Tasks created in Windows are stored in the Task Folder of Windows System Directory which in my case is C:\Windows\System32\Tasks.
- Navigate to Tasks Folder.
Here you will see a couple of folders with some files inside it. They represent the same folder structure of the Task Scheduler and files have same name too.
Now copy the task files to the machine you want to export to. You can also use it to backup your tasks in case your computer needs a re installation, so you don’t have to create again.
- Now rename the files with extension as .XML, this is the same extension used when you export the tasks using the Task Scheduler Interface.
- Once renamed, now use the Task Scheduler Import task feature to import them one by one as Windows will not recognize them if you drop them directly into the Tasks Folder of Windows.
Source How to mass export Tasks from Windows Task Scheduler
Solution 2:
Export Scheduled Tasks Configuration for Future Restore
Manually Export Jobs
Go to the scheduled tasks from Task Scheduler and one by one right click and select export
When the Save As window pops up, navigate to a folder where you want to save that configuration and ensure the File name matches the job name and then press Save.
Manually Import/Restore Jobs
Go to the Task Scheduler folder where you want the restored job to reside, right click that folder to the right and select Import
When the Open window pops up, navigate to the folder where you saved job configuration xml file, click on that file with the matching job name you want to restore, and then select Open.
When the Create Task window opens, go through all the options to double check the various tab settings if you want, and then press OK. If you're prompted for security credentials at this point, just type those in just as you would have whenever you set those up originally from the server you exported them from originally—security context will need to be in place if needed.
Note: The file name of the XML file minus the
.xml
extension will be the Name of the job in Task Scheduler. If there is already a job with the same name that exists in the Task Scheduler folder you import it into, you will be given an error message indicating this and it will not allow duplicates to be created.Otherwise, your scheduled tasks which you exported from one server (or the same server) and then imported to another server (or the same server) should be in place with the same configurations, etc. just as expected.
Further Resources
If you're interested in a PowerShell or scripted solution then. . .
- Export a Scheduled Task from PowerShell