Task Scheduler

How to Import or Export Tasks from Task Scheduler in Windows 10

How to Import or Export Tasks from Task Scheduler in Windows 10

Task Scheduler is a tool that allows you to create and automate routine tasks on a Windows 10 computer. The native tool is mainly used to run any monitoring tools, and for maintenance tasks such as disk defragmentation, disk cleanup, and to install Windows updates. In this post, we will show you the ways in which you can import or export Tasks from Task Scheduler in Windows 10.

Task Scheduler can also be used to execute tasks such as starting an application, sending an email message, run commands, to execute scripts at a particular day and time, or showing a message box.

Task Scheduler can be scheduled in response to the following events or triggers:

You can create tasks and schedule based on the above response.

Tasks can be saved as well and if you want, you can import or export the task from one computer to another.

Import or Export Tasks from Task Scheduler

You can import or export scheduled tasks from the Task Scheduler in Windows 10 in any of the three following methods:

  1. Using Task Scheduler
  2. Using Command Prompt
  3. Using PowerShell

Let's take a look at the steps involved in relation to each of the listed methods.

1] Using Task Scheduler

This method of using Task Scheduler to import or export scheduled Tasks in Windows 10 is the easiest.

Export

To export, do the following:

After saving you can find the XML file in that particular saved location. You can copy this XML file to another machine using a USB drive or you can email the file.

Import

To import, do the following:

Before importing make sure you have copied all the required files to run the tasks. For example, if you are going to run any PowerShell scripts make sure you have copied the script along with the XML file.

Exporting Tasks only export the Task Scheduler task configurations. It won't copy the required files. So copy all the required files and then start importing.

If you already configured any Task Settings do it after the import.

2] Using Command Prompt

To import or export scheduled Tasks in Windows 10 using Command Prompt, you will need to use the Schtasks.exe command. This command enables users to create, delete, query, change, run, and end scheduled tasks on a local or remote computer.

Export

To export, do the following:

schtasks /Query /XML /TN “task_location\task_name” > “%UserProfile%\Desktop\Export Tasks\name.xml”

Once the command is executed make sure the file is located in the correct location which you have mentioned in the command.

Import

To import, do the following:

There is no import option in the command prompt. So, instead of importing and setting the location and script, you can create a new task using the same XML file you exported.

Open Command Prompt in admin/elevated mode.

In the CMD window, copy and paste the command below and hit Enter.

schtasks /create /xml “%UserProfile%\XML file Path\TaskName.xml” /tn “\TASKSCHEDULER-FOLDER-PATH\TASK- NAME” /ru “COMPUTER-NAME\USER-NAME” /rp SystemPassword

Replace the following placeholders in the command:

“%UserProfile%\XML file Path\TaskName.xml - Copy the exported XML file path.

TASKSCHEDULER-FOLDER-PATH - Replace it with the Task location path of the Task in Task Scheduler.

TASK- NAME - You can give any name.

COMPUTER-NAME - Your system Hostname. To get hostname from the system, type hostname in CMD prompt and hit Enter.

USER-NAME - Your system username.

SystemPassword - Input your system password, if you have set one.

3] Using PowerShell

To import or export scheduled Tasks in Windows 10 using PowerShell, you will need to use the Export-ScheduledTask cmdlet.

Export

To export, do the following:

Press Windows key + X to access the Power User Menu.

Tap A on the keyboard to launch PowerShell in admin/elevated mode.

In the PowerShell console, copy and paste the command below and hit Enter.

Export-ScheduledTask -TaskName “task location from scheduler\task name” > “$env:UserProfile\Desktop\name.xml”

Replace the following placeholders in the command:

Once you execute the command the task will be exported to the specified location.

Import

To import, do the following:

Here, just like in Command Prompt, there is no import command in PowerShell also. So, you'll need to use the Register command to create the new task with the exported XML file.

Open PowerShell in admin mode.

In the PowerShell window, copy and paste the command below with slight modification as per your requirement.

Register-ScheduledTask -xml (Get-Content 'C:\PASTE THE PATH OF THE EXPORTED XML FILE WITH NAME.XML ' | Out-String) -TaskName “TASK-IMPORT-NAME” -TaskPath “\TASK-PATH-TASKSCHEDULER\” -User COMPUTER-NAME\USER-NAME -Password TYPE YOUR PASSWORD -Force

Make sure all the caps placeholders are replaced accordingly and execute the command. After the execution of the command, the exported task scheduler will be created as a new task in the Task Scheduler.

The above are the 3 ways you can import or export Tasks from Task Scheduler in Windows 10.

How to Develop a Game on Linux
A decade ago, not many Linux users would predict that their favorite operating system would one day be a popular gaming platform for commercial video ...
Open Source Ports of Commercial Game Engines
Free, open source and cross-platform game engine recreations can be used to play old as well as some of the fairly recent game titles. This article wi...
Parhaat komentorivipelit Linuxille
Komentorivi ei ole vain suurin liittolainen Linuxia käytettäessä - se voi olla myös viihteen lähde, koska voit käyttää sitä pelaamaan monia hauskoja p...