We had a requirement to migrate our existing servers that have around hundreds of scheduled tasks.
Creating those tasks manually is cumbersome therefore created this solution for current situation and future, for backing up and restoring the tasks to new server.
Download and extract the Solution from Github
First Script is Export Tasks solution, when you run it, it will extract all the scheduled tasks in corresponding folders according to Task folder Names.
Only exception is, this script will not extract built-in Microsoft tasks. (If you want that as well just modify the script)
if(($TaskFolderPath) -and ($TaskFolderPath -notlike “*Microsoft*”))
Copy these exported tasks xml structure now to the new server.
Second Script can take this as input and import these tasks on the new server.
.\ImportTasks.ps1 -task_path C:\ExportImportTasks\ExportImportTasks\Sctasks -task_Folder Sctasks -task_user firstname.lastname@example.org -task_pass 12345678
This script has been parametrized so that you can import it as per requirements with userid and password.
I hope this solution will assist you for migration of tasks as well as backup of these on regular basis.
Thanks for reading and downloading …