Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

...

Introduction

  • Windows Task Scheduler® jobs can be migrated to JobSchedulerJS7.
  • SOS provides a PowerShell script that creates JobScheduler job configuration files which creates JS7 workflows, calendars and schedules from Windows Task Scheduler® jobs.

...

Download

  • Download the PowerShell cmdlet (verify signed scripts):   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 JS7 releases 12.12 and 1.13..x.

PowerShell Cmdlet

Name

ConvertFrom-WindowsTaskScheduler

SYNOPSIS

Converts jobs from the Windows Task Scheduler Scheduler® to JobScheduler.JS7

SYNTAX

ConvertFrom-WindowsTaskScheduler [-AgentName <String>] [[-TaskName] <String>] [[-TaskPath] <String>] [[-OutputDirectory] <String>] [[-ArchivePath] <String>]  [[-CalendarName] <String>]  [[-Timezone] <String>]  [<CommonParameters>]

DESCRIPTION

The job configuration from Windows Task Scheduler Scheduler® is converted to XML job JSON files that which can be imported and 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.

JS7.

This includes creating a workflow JSON file and a schedule JSON file per converted job. JSON XML job file names are created from the Windows Task Scheduler folder paths and task namesScheduler® task names.

The cmdlet adds JSON files to a .zip archive which can be imported into JS7.

PARAMETERS

AgentName

-AgentName <String>

Specifies the name of an Agent that should execute the converted jobs. Typically this will be an Agent running on the Windows machine from which jobs are converted.

Required?true
Position?1
Default value
Accept pipeline input?true (ByPropertyName)
Accept wildcard characters?false

TaskName

-TaskName <String>

Specifies an individual job to be converted. Consider Note that job names are not unique with Windows Task SchedulerScheduler®. When used with the -TaskPath parameter then a single job can be selected.

Without this parameter all jobs are converted.

Required?false
Position?12
Default value
Accept pipeline input?true (ByPropertyName)
Accept wildcard characters?false

TaskPath

-TaskPath <String>

Specifies the path in the Windows Task Scheduler Scheduler® repository from which jobs should be converted.

Without this parameter jobs from any all paths are converted.

Required?false
Position?23
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 is not exist then it will be created. By default the working directory is usedspecified then a temporary directory is created and is removed after conversion of jobs.

Required?false
Position?4
Default value
Accept pipeline input?true (ByPropertyName)
Accept wildcard characters?false

ArchivePath

-ArchivePath <String>

Specifies the name of the .zip archive that holds the converted jobs and which is used for import into JS7.

By default the .zip archive is created in the current directory with the name js7-import.zip.

Required?false
Position?5
Default valuejs7-import.zip
Accept pipeline input?true (ByPropertyName)
Accept wildcard characters?false

CalendarName

-CalendarName <String>

Specifies the name of a common calendar for converted jobs in the JS7 inventory. All converted jobs use the same calendar.

By default a calendar with the name "Everyday" is created.

Required?false
Position?36
Default valueEveryday
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 added to the run-time settings of jobs. Consider Note that a JobScheduler Master JS7 might be operated in a time zone
that zone which is different from the time zone that the Windows Task Scheduler Scheduler® is operated in.

For PowerShell FullCLR 5.1 the computer's time zone is used, for later PowerShell versions the UTC time zone is used by default.

Required?false
Position?47
Default value(&{ if ( $PSVersionTable.PSVersion.Major -le 5 ) {
[Windows.Globalization.Calendar,Windows.Globalization,ContentType=WindowsRuntime]::New().GetTimeZone() } else { 'Etc/UTC' } })
Accept pipeline input?true (ByPropertyName)
Accept wildcard characters?false

EXAMPLES

-------------------------- EXAMPLE 1 --------------------------

PS > ConvertFrom> ./ConvertFrom-WindowsTaskScheduler.ps1 -AgentName windowsAgent -TaskPath \Microsoft\Windows\Defrag\ -TaskName ScheduledDefrag -OutputDirectory C:/tmp/jobs

Converts the job from the specified folder path and writes the XML job file JSON files to the c C:/tmp/jobs directory. Converted jobs are available for import from the default archive file js7-import.zip in the current directory.

-------------------------- EXAMPLE 2 --------------------------

PS > ConvertFrom> ./ConvertFrom-WindowsTaskScheduler.ps1 -AgentName windowsAgent -TaskPath \ -OutputDirectory C:/tmp/jobs

Converts jobs available in the root folder of Windows Task Manager Scheduler® and writes the XML job file JSON files to the c C:/tmp/jobs directory.

-------------------------- EXAMPLE 3 --------------------------

PS > ConvertFrom> ./ConvertFrom-WindowsTaskScheduler -TaskName ScheduledDefrag .ps1 -AgentName windowsAgent -Timezone 'Europe/London' -CalendarName DailyCalendar -OutputDirectory C:/tmp/jobs

Converts job(s) with the given name all jobs from any folder folders and writes the XML job file(s) JSON files to the c C:/tmp/jobs directory. The specified Joda time zone is added to the run-time settings of converted jobs. The specified calendar is created and assigned the converted jobs.

-------------------------- EXAMPLE 4 --------------------------

PS > ConvertFrom> ./ConvertFrom-WindowsTaskScheduler -Timezone 'Europe/London' .ps1 -AgentName windowsAgent -ArchivePath C:/tmp/js7-import.zip -OutputDirectory C:/tmp/jobs

Converts all jobs from any all folders and writes the XML job JSON files to the c C:/tmp/jobs directory.
The specified Joda time zone is added to the run-time settings of converted jobs.

Limitations

...

Converted jobs are available from the  C:/tmp/js7-import.zip archive file for import into JS7.

Limitations

  • Actions of Windows Task Scheduler Scheduler® jobs are mapped to a single JobScheduler JS7 job script.
  • For cyclic jobs in JobScheduler JS7, repetitions have to occur within a 24 hours period. Windows Task Scheduler Scheduler® knows about repetitions that exceed this period.

...