Scope
- Windows Task Scheduler® jobs can be migrated to JobScheduler.
- SOS provides a PowerShell script that creates JobScheduler job configuration files from Windows Task Scheduler® jobs.
PowerShell Cmdlet
- Download the PowerShell cmdlet: ConvertFrom-WindowsTaskScheduler.ps1
- The PowerShell cmdlet can be used with Windows PowerShell FullCLR 5.1 and PowerShell CoreCLR 6.x and 7.x for Windows environments. It can be used for JobScheduler releases 1.12 and 1.13..
Name
ConvertFrom-WindowsTaskScheduler
SYNOPSIS
Converts jobs from Windows Task Scheduler to JobScheduler.
SYNTAX
ConvertFrom-WindowsTaskScheduler [[-TaskName] <String>] [[-TaskPath] <String>] [[-OutputDirectory] <String>] [[-Timezone] <String>] [<CommonParameters>]
DESCRIPTION
The job configuration from Windows Task Scheduler is converted to XML job files that can be deployed to JobScheduler Master.
The cmdlet writes XML job files to an output directory. You can copy such files to the JobScheduler Master's ./config/live folder to deploy your jobs.
XML job file names are created from the Windows Task Scheduler folder paths and task names.
PARAMETERS
TaskName
-TaskName <String>
Specifies an individual job to be converted. Consider that job names are not unique with Windows Task Scheduler. When used with the -TaskPath parameter then a single job can be selected.
Without this parameter all jobs are converted.
Required? | false |
Position? | 1 |
Default value | |
Accept pipeline input? | true (ByPropertyName) |
Accept wildcard characters? | false |
TaskPath
-TaskPath <String>
Specifies the path in the Windows Task Scheduler repository from which jobs should be converted.
Without this parameter jobs from any paths are converted.
Required? | false |
Position? | 2 |
Default value | |
Accept pipeline input? | true (ByPropertyName) |
Accept wildcard characters? | false |
OutputDirectory
-OutputDirectory <String>
Specifies the output directory for converted jobs.
If the directory does not exist then it will be created. By default the working directory is used.
Required? | false |
Position? | 3 |
Default value | |
Accept pipeline input? | true (ByPropertyName) |
Accept wildcard characters? | false |
Timezone
-Timezone <String>
Accepts the name of a Joda time zone, see http://joda-time.sourceforge.net/timezones.html
The cmdlet does not convert dates according to this time zone, instead the specified time zone is added to the run-time settings of jobs. Consider that a JobScheduler Master might be operated in a time zone
that is different from the time zone that the Windows Task Scheduler is operated for.
Required? | false |
Position? | 4 |
Default value | |
Accept pipeline input? | true (ByPropertyName) |
Accept wildcard characters? | false |
EXAMPLES
-------------------------- EXAMPLE 1 --------------------------
PS > ConvertFrom-WindowsTaskScheduler -TaskPath \Microsoft\Windows\Defrag\ -TaskName ScheduledDefrag -OutputDirectory C:/tmp/jobs
Converts the job from the specified folder and writes the XML job file to the c:/tmp/jobs directory.
-------------------------- EXAMPLE 2 --------------------------
PS > ConvertFrom-WindowsTaskScheduler -TaskPath \ -OutputDirectory C:/tmp/jobs
Converts jobs available in the root folder of Windows Task Manager and writes the XML job file to the c:/tmp/jobs directory.
-------------------------- EXAMPLE 3 --------------------------
PS > ConvertFrom-WindowsTaskScheduler -TaskName ScheduledDefrag -OutputDirectory C:/tmp/jobs
Converts job(s) with the given name from any folder and writes the XML job file(s) to the c:/tmp/jobs directory.
-------------------------- EXAMPLE 4 --------------------------
PS > ConvertFrom-WindowsTaskScheduler -Timezone 'Europe/London' -OutputDirectory C:/tmp/jobs
Converts all jobs from any folders and writes the XML job files to the c:/tmp/jobs directory.
The specified Joda time zone is added to the run-time settings of converted jobs.
Limitations
- Triggers for monthly job execution are not converted as there is no public API for this trigger type.
- Actions of Windows Task Scheduler jobs are mapped to a single JobScheduler job script.
- For cyclic jobs in JobScheduler repetitions have to occur within a 24 hours period. Windows Task Scheduler knows about repetitions that exceed this period.