Windows Server

How to export and import scheduled tasks on Windows Server with the Task scheduler and PowerShell

Windows Task Scheduler enables Administrators to quickly create and run tasks automatically. Using this tool, you can launch apps, run scripts, or execute commands at a particular day and time, or even during a specific event. For some articles on Task Scheduler, see the links below.

– How to create, edit and delete a scheduled task via the command prompt (CMD), see https://techdirectarchive.com/2020/03/31/how-to-create-edit-and-delete-a-scheduled-task-via-the-command-prompt-cmd/
– How to run, edit, and delete a task using Task Scheduler GUI (taskschd.msc), see https://techdirectarchive.com/2020/04/02/how-to-run-edit-and-delete-a-task-using-task-scheduler-gui-taskschd-msc/
– How to create advanced scheduled task on Windows Server with Windows Task Scheduler, see https://techdirectarchive.com/2020/03/24/how-to-create-a-scheduled-task-on-windows-server-2019/
– How to schedule Windows Defender Antivirus to scan on-demand in Windows, see https://techdirectarchive.com/2020/04/03/how-to-schedule-windows-defender-antivirus-to-scan-on-demand-in-windows/
– How to automate Windows Update with PowerShell and Task Scheduler, see https://techdirectarchive.com/2020/03/24/how-to-orchestrate-windows-update-with-powershell-and-task-scheduler/

Import Scheduled Tasks: This step can be achieved with the following steps below.

Note: There are two options to import a task, you can either click on the “Action” tab in the menu bar as shown below or click on “Import Tasks…” under the Action pane on the right.

This will open the file explorer as shown below, select the location of the file that you need to import.
– Click on Open.

The import process will display the task properties as shown below

Now, you can continue with the customization as shown in the image above. Every setting that needs customization has been marked as well.

Note if you are okay with the imported scheduled tasks,
– Click on Ok
– And you will be requested to enter your credentials to confirm

Export Scheduled Task: Now to export a task, this is extremely very straight forward as well.

There are three options to export a task, you can either click on the “Action” tab in the menu bar and select “Export” as shown below or click on “Export ” under the Selected Item pane on the right.

You can also right-click on the configured scheduled task and select “Export”.

Next, select a location to have this file saved to and click on save as shown below.

Export-ScheduledTask with PowerShell: For more information, see https://docs.microsoft.com/en-us/powershell/module/scheduledtasks/export-scheduledtask?view=win10-ps

Export-ScheduledTask -TaskName "UpdateDrivers" -TaskPath "\UpdateTasks\"

Import–ScheduledTask with PowerShell: modify the following syntax below.

Register-ScheduledTask -Xml (get-content '\\fp01\it\Weekly System Info Report.xml' | out-string) -TaskName "Weekly System Info Report" -User techdirect\administrator -Password P@ssw0rd –Force

On how to create a scheduled task with Windows Admin Center (WAC), see https://techdirectarchive.com/2020/03/26/how-to-create-a-scheduled-task-with-windows-admin-center/

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x