Task scheduler is a tool that lets you create and automate routine tasks on a Windows 10 computer. The native tool is mainly used to run monitoring tools and for maintenance tasks such as disk defragmentation, disc cleaningand to install Windows updates. In this article, we will show you the ways you can import or export tasks from the Task Scheduler in Windows 10.
The Task Scheduler can also be used to execute tasks such as starting an application, sending an email, executing commands, running scripts on a particular day and time. or displaying a message box.
The Task Scheduler can be scheduled in response to the following events or triggers:
- At a specific time.
- At a specific time on a daily schedule.
- At a specific time on a weekly schedule.
- At a specific time on a monthly calendar.
- At system startup.
- When the computer enters an inactive state.
- When a user logs in.
- When the task is saved.
You can create tasks and a calendar based on the answer above.
Tasks can also be saved and if desired, you can import or export the task from one computer to another.
Import or export tasks from the Task Scheduler
You can import or export scheduled tasks from the Task Scheduler in Windows 10 in one of three ways:
- Using the task scheduler
- Using the command prompt
- Using PowerShell
Let’s look at the steps involved in relation to each of the methods listed.
1]Using the task scheduler
This method of using the Task Scheduler to import or export scheduled tasks in Windows 10 is the easiest.
Export
To export, do the following:
- hurry Windows key + R to call the Run dialog box.
- In the Run dialog box, type taskschd.msc
- hurry CTRL + SHIFT + ENTER combo of keys to open the Task Scheduler in administrator mode.
- Click to enlarge Task scheduler library in the left pane.
- In the center pane, right-click the task and choose Export.
- Choose the location to save the file.
- Click on the to save button.
After saving, you can find the XML file at that particular saved location. You can copy this XML file to another machine using a USB stick or you can send the file by email.
Import
To import, do the following:
Before importing, make sure you have copied all of the files required to perform the tasks. For example, if you plan to run PowerShell scripts, make sure you have copied the script with the XML file.
Exporting tasks only exports Task Scheduler task configurations. It will not copy the required files. So copy all the required files, then start the import.
- Open the Task scheduler in administrative mode.
- Click to enlarge Task scheduler library in the left pane.
- Right click on the task folder and choose Import task.
- Now browse the XML file location and click Open.
If you have already configured task settings, do so after import.
2]Using the command prompt
To import or export scheduled tasks in Windows 10 using the command prompt, you’ll need to use the Schtasks.exe order. This command allows users to create, delete, query, modify, execute, and complete scheduled tasks on a local or remote computer.
Export
To export, do the following:
- hurry Windows key + R. to call the Run dialog box.
- In the Run dialog box, type cmd then press CTRL + SHIFT + ENTER to open the command prompt in administrator / elevated mode.
- In the command prompt window, copy and paste the command below and press Enter. Replace the task_location and Task Name placeholder with the actual location and name of the task in the Task Scheduler. You can find the location and name of the task, if you click on the task in the center pane. Replace % User profile% with your full profile path. for example C: Users Chidum.Osobalu.
schtasks /Query /XML /TN “task_locationtask_name” > “%UserProfile%DesktopExport Tasksname.xml”
Once the command is executed, make sure that the file is in the correct location that you mentioned in the command.
Import
To import, do the following:
There is no import option in the command prompt. So instead of importing and defining the location and the script, you can create a new task using the same XML file that you exported.
Open the command prompt in administrator / elevated mode.
In the CMD window, copy and paste the command below and press Enter.
schtasks /create /xml “%UserProfile%XML file PathTaskName.xml” /tn “TASKSCHEDULER-FOLDER-PATHTASK- NAME” /ru “COMPUTER-NAMEUSER-NAME” /rp SystemPassword
Replace the following placeholders in the order:
- “% UserProfile% XML file Path TaskName.xml – Copy the path of the exported XML file.
- TASKSCHEDULER-FOLDER-PATH – Replace it with the task path of the task in the Task Scheduler.
- TASK NAME – You can give any name.
- COMPUTER NAME – The host name of your system. To get the system hostname, type host name in the CMD prompt and press Enter.
- USERNAME – Your system user name.
- SystemPassword – Enter 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:
hurry Windows key + X to access the Power User menu.
Tap A on the keyboard to launch PowerShell in administrator / high mode.
In the PowerShell console, copy and paste the command below and press Enter.
Export-ScheduledTask -TaskName “task location from schedulertask name” > “$env:UserProfileDesktopname.xml”
Replace the following placeholders in the order:
- Location of tasks from the scheduler
- Task Name
- Name.xml
Once you have executed the command, the task will be exported to the specified location.
Import
To import, do the following:
Here, just like in the command prompt, there is no import command in PowerShell as well. You will therefore have to use the Save the order to create the new task with the exported XML file.
Open PowerShell in administrator mode.
In the PowerShell window, copy and paste the command below with a slight modification as needed.
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-NAMEUSER-NAME –Password TYPE YOUR PASSWORD -Force
Make sure that all caps placeholders are replaced accordingly and run the command. After executing the command, the exported task scheduler will be created as a new task in the task scheduler.
The three methods above let you import or export tasks from the Task Scheduler in Windows 10.