Export Task from Task Scheduler in Windows  

    Export Task from Task Scheduler in Windows

    Export Task from Task Scheduler in Windows

    How to Export a Task from Task Scheduler in Windows
    Published by Category: Backup & Restore
    07 Feb 2021
    Designer Media Ltd

    How to Export a Task from Task Scheduler in Windows


    The Task Scheduler enables you to automatically perform routine tasks on a chosen computer. The Task Scheduler does this by monitoring whatever criteria you choose to initiate the tasks (referred to as triggers) and then executing the tasks when the criteria is met.

    You can export a task so that the task is stored in an XML file which can be imported by other users and computers. A task's properties, triggers, actions, conditions, and settings are represented in an XML file.

    If you created a task in Task Scheduler, then it would be a good idea to back up the task by exporting it as an XML to make it easy to restore (import) in the future as needed.

    This tutorial will show you different ways on how to export a task from Task Scheduler as an .xml file backup in Vista, Windows 7, Windows 8, and Windows 10.


    Contents







    OPTION ONE

    To Export a Task in Task Scheduler


    1 Press the Win + R keys to open the Run dialog, type taskschd.msc into Run, and click/tap on OK to open Task Scheduler.

    2 Navigate to the task folder location (ex: "Task Scheduler Library") in the left pane, select the task (ex: "Create Restore Point on Schedule") you want to export in the middle pane, and click/tap on Export in the far right Actions pane. (see screenshot below)

    Export Task from Task Scheduler in Windows-export_task-1.png

    3 Browse to the location you want to export the task, type in a name you want for the .xml file, and click/tap on Save. (see screenshot below)

    Export Task from Task Scheduler in Windows-export_task-2.png

    4 When finished, you can close Task Scheduler if you like.






    OPTION TWO

    To Export a Task in Command Prompt


    For more usage details about the schtasks and schtasks /Query commands, see: Schtasks.exe | Microsoft Docs)


    1 Open a command prompt.

    2 Type the command below into the command prompt, and press Enter. (see screenshot below)

    schtasks /Query /XML /TN "task folder location\task name" > "%UserProfile%\Desktop\name.xml"

    Export Task from Task Scheduler in Windows-export_task_command.png

    Substitute task folder location in the command above with the actual task's folder location (ex: "") like in Task Scheduler below.

    Substitute task name in the command above with the actual task's name (ex: "Create Restore Point on Schedule") like in Task Scheduler below.

    Substitute name in the command above with the name you want for the exported .xml file.

    For example: schtasks /Query /XML /TN "\Create Restore Point on Schedule" > "%UserProfile%\Desktop\taskname.xml"

    Export Task from Task Scheduler in Windows-task_info.png


    3 You can now move the .xml file on your desktop to where you like as a backup of this task.

    4 When finished, you can close the command prompt if you like.






    OPTION THREE

    To Export a Task in PowerShell


    For more details about the Export-ScheduledTask command, see: Export-ScheduledTask | Microsoft Docs


    1 Open PowerShell.

    2 Type the command below into PowerShell, and press Enter. (see screenshot below)

    Export-ScheduledTask -TaskName "task folder location\task name" > "$env:UserProfile\Desktop\name.xml"

    Export Task from Task Scheduler in Windows-export_task_powershell.png

    Substitute task folder location in the command above with the actual task's folder location (ex: "") like in Task Scheduler below.

    Substitute task name in the command above with the actual task's name (ex: "Create Restore Point on Schedule") like in Task Scheduler below.

    Substitute name in the command above with the name you want for the exported .xml file.

    For example: Export-ScheduledTask -TaskName "\Create Restore Point on Schedule" > "$env:UserProfile\Desktop\taskname.xml"

    Export Task from Task Scheduler in Windows-task_info.png


    3 You can now move the .xml file on your desktop to where you like as a backup of this task.

    4 When finished, you can close PowerShell if you like.


    That's it,
    Shawn






  1. Posts : 61
    windows 10
       #1

    export all tasks: Create a folder "task" in the desktop
    Run Powershell as admin:
    Code:
    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: https://www.petri.com/import-scheduled-tasks-powershell
    credit to the link above
      My Computer


  2. Posts : 5
    Windows 10 Home
       #2

    chok said:
    export all tasks: Create a folder "task" in the desktop
    Run Powershell as admin:
    Code:
    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: https://www.petri.com/import-scheduled-tasks-powershell
    credit to the link above
    Does anyone have another working link since Petri seems is offline
      My Computer


  3. Posts : 68,543
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #3

    Hello EASTER,

    You could just manually create the PS1 file with the code posted above, and run as administrator.

    Be sure to substitute the path to your desktop folder instead.
      My Computers


  4. Posts : 5
    Windows 10 Home
       #4

    Brink said:
    Hello EASTER,

    You could just manually create the PS1 file with the code posted above, and run as administrator.

    Be sure to substitute the path to your desktop folder instead.
    Thanks Brink! Its fascinating so many tweaks that most have passed over or not even found yet that make our computers more automated or simply improve conveniences to save time and effort.
      My Computer


  5. Posts : 68,543
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #5

    EASTER said:
    Thanks Brink! Its fascinating so many tweaks that most have passed over or not even found yet that make our computers more automated or simply improve conveniences to save time and effort.
      My Computers


  6. Posts : 7
    Windows 10 x64
       #6

    I do understand the Get-ScheduledTask | foreach {
    Export-ScheduledTask -TaskName $_.TaskName -TaskPath $_.TaskPath |
    Out-File (Join-Path "C:\Users\Me\Desktop\task" "$($_.TaskName).xml")
    }

    I just only need to edit \Me\ but can someone help me how to PS1 for Import Restore Multi of .xml

    Thank
      My Computer


 

Tutorial Categories

Export Task from Task Scheduler in Windows Tutorial Index Network & Sharing Instalation and Upgrade Browsers and Email General Tips Gaming Customization Apps and Features Virtualization BSOD System Security User Accounts Hardware and Drivers Updates and Activation Backup and Restore Performance and Maintenance Mixed Reality Phone


  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 02:16.
Find Us




Windows 10 Forums