How to Import (Restore) All Tasks in Bulk Using Task Scheduler in Windows?

Recently we posted a tutorial about importing and exporting tasks using Task Scheduler in Windows:

How to Import / Export (Backup / Restore) Tasks Using Task Scheduler in Windows?

But there is one limitation in importing and exporting tasks using Task Scheduler. You can import/export only a single task at a time. Task Scheduler doesn’t allow import/export of tasks in bulk.

Advertisement

Import_Backup_Task_Scheduler.png

So if you have lots of scheduled tasks say 20 in Task Scheduler, you’ll need to perform the same step again and again for all 20 tasks.

Wouldn’t it be great if you can import and export all tasks in a single step?

Actually you can import (restore) all tasks in bulk using “schtasks” command but there is no way to export all tasks in bulk.

In this tutorial, we’ll tell you how to use “schtasks” command to restore all tasks in bulk:

1. First take backup of all tasks using the above mentioned tutorial.

2. Now create a new text file using Notepad and paste following code in it:

Advertisement

@echo off
echo Importing All Tasks
echo.
schtasks.exe /create /TN “Task 1 Name” /XML “Full_Path_of_Backup_XML_File
schtasks.exe /create /TN “Task 2 Name” /XML “Full_Path_of_Backup_XML_File
schtasks.exe /create /TN “Task 3 Name” /XML “Full_Path_of_Backup_XML_File
echo.
echo Importing Done
echo.
pause

3. Replace “Task 1 Name”, “Task 2 Name”, etc entries with the name of your actual tasks. e.g. “Mother Birthday“.

4. Replace “Full_Path_of_Backup_XML_File” with the location where you saved the backup tasks. e.g. “D:\Tasks Backup\Mother Birthday.xml“.

5. Save the file with any name but the extension must be .BAT. e.g. you can save the file as “Restore Tasks.Bat“. Make sure to use double quotes “” otherwise Notepad will save the file as a text file.

6. That’s it. Once you create the file, run it and it’ll start restoring all the tasks in Task Scheduler.

Now you’ll never need to create all your important tasks each time you install a fresh Windows or work on a new computer. Just import all the tasks on the fly using the above mentioned batch file. 😉

PS: You can use the same Batch file for restoring any number of tasks. Simply add an entry for the desired task mentioning its name and location.

Published in: Troubleshooting Guides, Windows 7, Windows Vista, Windows XP

About the author: Vishal Gupta (also known as VG) has been awarded with Microsoft MVP (Most Valuable Professional) award. He holds Masters degree in Computer Applications (MCA). He has written several tech articles for popular newspapers and magazines and has also appeared in tech shows on various TV channels.

Comments

NOTE: Older comments have been removed to reduce database overhead.

  1. I trying to use this bulk loading of tasks and get an error. What I’m I missing? The tasks load manually just fine Here is my revised bat file.

    @echo off
    echo Importing All Tasks
    echo.
    schtasks.exe /create /TN “Task1” /XML “C:\Windows\Tasks\XML”
    schtasks.exe /create /TN “Task2” /XML “C:\Windows\Tasks\XML”
    schtasks.exe /create /TN “Task3” /XML “C:\Windows\Tasks\XML”
    echo.
    echo Importing Done
    echo.
    pause

    Thanks for any suggestion.

  2. The “Permission Denied” error I’m getting seems to require a password. Is it possible to include a password?

  3. Hi,
    I tries Importing all the tasks of one server to another through this technique. But Whenever i run this batch file some of the tasks is displaying an error with “Bad username or Password”, Is there any Solution through which i can specify username and password in the batch file at one go.

    Awaiting Your Reply,

    Thanks and Regards
    Rammohan B

  4. This document is very helpfull but I have issue woth below given error code.

    My system is connected with windows AD domain base.
    I request you to please help me ASAP

    Importing All Tasks

    ERROR: Logon failure: unknown user name or bad password.
    ERROR: Logon failure: unknown user name or bad password.
    ERROR: Logon failure: unknown user name or bad password.
    ERROR: Logon failure: unknown user name or bad password.
    ERROR: Logon failure: unknown user name or bad password.
    ERROR: Logon failure: unknown user name or bad password.
    ERROR: Logon failure: unknown user name or bad password.
    ERROR: Logon failure: unknown user name or bad password.
    ERROR: Logon failure: unknown user name or bad password.
    ERROR: Logon failure: unknown user name or bad password.
    ERROR: Logon failure: unknown user name or bad password.
    ERROR: Logon failure: unknown user name or bad password.
    ERROR: Logon failure: unknown user name or bad password.
    ERROR: Logon failure: unknown user name or bad password.
    ERROR: Logon failure: unknown user name or bad password.
    ERROR: Access is denied.
    ERROR: Logon failure: unknown user name or bad password.
    ERROR: Logon failure: unknown user name or bad password.
    ERROR: Logon failure: unknown user name or bad password.
    ERROR: Logon failure: unknown user name or bad password.
    ERROR: Logon failure: unknown user name or bad password.
    ERROR: Logon failure: unknown user name or bad password.
    ERROR: Logon failure: unknown user name or bad password.
    ERROR: Logon failure: unknown user name or bad password.
    ERROR: Logon failure: unknown user name or bad password.

    Importing Done

    Press any key to continue . . .

  5. ^^ Open the XML file of the task and make sure the mentioned user account name is same as the current logged in user account name. If not, then correct the user account name in XML file.

  6. Thanks for your response on our request

    I am face same issue after given best suggested technical solution, but I faced same issue on the same with below given xml details

    2016-07-18T17:24:51.3050737
    COVENTYA1\s.shelke

    true
    <QueryList><Query Id=”0″ Path=”Microsoft-Windows-Backup”><Select Path=”Microsoft-Windows-Backup”>*[System[Provider[@Name=’Microsoft-Windows-Backup’] and EventID=4]]</Select></Query></QueryList>

    COVENTYA1\s.shelke
    Password
    LeastPrivilege

    IgnoreNew
    true
    true
    true
    true
    true

    true
    false

    true
    true
    false
    false
    false
    P3D
    7

    “****************************(PATH OF XML FILE******************************************”

  7. export task sheduler
    Create a folder “task” in the desktop
    Run Powershell as admin:
    Get-ScheduledTask | foreach {
    Export-ScheduledTask -TaskName $_.TaskName -TaskPath $_.TaskPath |
    Out-File (Join-Path “C:\Users\Me\Desktop\task” “$($_.TaskName).xml”)
    }

    Import/Restore all tasks tasks

    Register-ScheduledTask -Xml (get-content ‘\\chi-fp01\it\Weekly System Info Report.xml’ | out-string) -TaskName “Weekly System Info Report” -User globomantics\administrator -Password P@ssw0rd –Force

  8. This saved a lot of time for me, I was looking for the exactly same script. It imported more than 160 jobs in a jiffy.

    Used the DOS cmd command: dir /s /b /o:gn
    to list all the path of xml files in a folder.

Leave a Comment

Your email address will not be published. Required fields are marked *

NOTE: Your comment may not appear immediately. It'll become visible once we approve it.