Schedule Executions¶
A Schedule Execution is one run of a Schedule, from its first step to its last. These cmdlets start one on demand, follow it while it runs, read back what happened, and stop one that is queued or running. To create or change a Schedule itself, see Schedules.
Every Schedule Execution these cmdlets return carries StepDisplay, the step group it has reached as one sentence, so a script reads the same position the portal shows.
Start-JIMSchedule¶
Runs a Schedule now, whatever its trigger type and whether or not it is enabled: useful for testing a Schedule, or for running one on demand.
Syntax¶
Parameters¶
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
Id |
guid |
Yes | The unique identifier (GUID) of the Schedule to start. Accepts pipeline input by property name, Id or ScheduleId. |
|
Wait |
switch |
No | Waits for the Schedule Execution to finish (Complete, CompleteWithError, Failed or Cancelled), checking every 5 seconds and showing progress, then returns it. | |
Timeout |
timespan |
No | [TimeSpan]::FromMinutes(30) |
How long -Wait waits before it gives up with a warning. The Schedule Execution carries on in JIM. |
PassThru |
switch |
No | Returns the new Schedule Execution. |
Output¶
With -PassThru, the new Schedule Execution as it stands; with -Wait, the execution once it has finished, or as it stands when the timeout is reached; otherwise nothing.
| Property | Type | Description |
|---|---|---|
Steps |
object[] |
One entry per Schedule Step: its name, type, timings, errors and Activity id. A step group that runs three Run Profiles concurrently appears here three times, and once in Progress. Each has StepIndex, Name, StepType, ExecutionMode, ConnectedSystemId, Status, TaskId, StartedAt, CompletedAt, ErrorMessage, ActivityId, ActivityStatus, ConnectedSystemName, RunProfileId, RunProfileName, ContinueOnFailure, FailureBehaviourSource and CancellationReason. |
Progress |
object |
How far through the Schedule this execution has got: the step group it has reached, and each group's outcome, including each concurrent task's own outcome where a group runs several. Empty where the execution recorded no steps. It has CurrentStepNumber, TotalSteps and Steps. |
Id |
guid |
The unique identifier of the execution. |
ScheduleId |
guid |
The schedule ID this execution belongs to. |
ScheduleName |
string |
The schedule name for display purposes. |
Status |
string |
The current status of the execution. One of Queued, InProgress, Complete, Failed, Cancelled, Paused or CompleteWithError. |
CurrentStepIndex |
int |
The current step group being executed (0-based). Schedule Steps that run concurrently share an index and are one position here, not several. |
TotalSteps |
int |
The number of step groups in the Schedule, counting the same thing as CurrentStepIndex so that the two can be read together as "step X of Y". |
QueuedAt |
datetime |
When the execution was queued (UTC). |
StartedAt |
datetime |
When the execution started (UTC). |
CompletedAt |
datetime |
When the execution completed (UTC). |
InitiatedByType |
string |
The type of principal that initiated the execution. One of NotSet, User, ApiKey, System or Anonymous. |
InitiatedById |
guid |
The ID of the principal that initiated the execution. |
InitiatedByName |
string |
The display name of the principal that initiated the execution. |
ErrorMessage |
string |
Error message if the execution failed. For a CompleteWithError execution, the message naming each failed step it carried on past. |
StepDisplay |
string |
The step group the execution has reached, as one sentence naming it, for example Step 2 of 5: 2 in parallel, matching what the portal shows in Admin > Operations > Activity. |
When -Wait reaches its timeout, the cmdlet warns, but the Schedule Execution carries on in JIM. Use Get-JIMScheduleExecution to follow it, or Stop-JIMScheduleExecution to cancel it.
Examples¶
Start-JIMSchedule -Id "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
Start-JIMSchedule -Id "a1b2c3d4-e5f6-7890-abcd-ef1234567890" `
-Wait -Timeout ([TimeSpan]::FromMinutes(60)) -PassThru
# Start-JIMSchedule works regardless of the schedule's enabled state
Get-JIMSchedule -Name "On-Demand Full Sync" | Start-JIMSchedule -Wait
Get-JIMScheduleExecution¶
Retrieves Schedule Executions: to follow one that is running, review past runs, or check how a particular one went.
Syntax¶
# List (default)
Get-JIMScheduleExecution [-ScheduleId <guid>] [-InputObject <PSCustomObject>] [-Status <string>]
# ById
Get-JIMScheduleExecution -Id <guid>
# Active
Get-JIMScheduleExecution -Active [-ScheduleId <guid>] [-InputObject <PSCustomObject>]
Parameters¶
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
Id |
guid |
Yes (ById) | The unique identifier (GUID) of a specific Schedule Execution to retrieve. Accepts pipeline input by property name, Id or ExecutionId. |
|
ScheduleId |
guid |
No (List, Active) | Returns only the executions of this Schedule. Accepts pipeline input by property name. | |
InputObject |
PSCustomObject |
No (List, Active) | A Schedule from the pipeline, for example from Get-JIMSchedule. Its Id filters the executions, as -ScheduleId does. Accepts pipeline input. |
|
Status |
string |
No (List) | Returns only the executions with this status. Queued is waiting to start and InProgress is running. Complete finished successfully; CompleteWithError finished, but one or more steps failed and were set to let the Schedule carry on. Failed was stopped by a failed step, or failed to run, and Cancelled was stopped. One of Queued, InProgress, Complete, CompleteWithError, Failed or Cancelled. |
|
Active |
switch |
Yes (Active) | Returns only the executions still under way: Queued or InProgress. |
Output¶
The list and -Active return a summary of each Schedule Execution; -Id returns one in full, with the progress of each step group.
By default, or with -Active:
| Property | Type | Description |
|---|---|---|
Id |
guid |
The unique identifier of the execution. |
ScheduleId |
guid |
The schedule ID this execution belongs to. |
ScheduleName |
string |
The schedule name for display purposes. |
Status |
string |
The current status of the execution. One of Queued, InProgress, Complete, Failed, Cancelled, Paused or CompleteWithError. |
CurrentStepIndex |
int |
The current step group being executed (0-based). Schedule Steps that run concurrently share an index and are one position here, not several. |
TotalSteps |
int |
The number of step groups in the Schedule, counting the same thing as CurrentStepIndex so that the two can be read together as "step X of Y". |
QueuedAt |
datetime |
When the execution was queued (UTC). |
StartedAt |
datetime |
When the execution started (UTC). |
CompletedAt |
datetime |
When the execution completed (UTC). |
InitiatedByType |
string |
The type of principal that initiated the execution. One of NotSet, User, ApiKey, System or Anonymous. |
InitiatedById |
guid |
The ID of the principal that initiated the execution. |
InitiatedByName |
string |
The display name of the principal that initiated the execution. |
ErrorMessage |
string |
Error message if the execution failed. For a CompleteWithError execution, the message naming each failed step it carried on past. |
StepDisplay |
string |
The step group the execution has reached, as its position, for example Step 2 of 5. A summary carries the position only, not what the step group is called. |
With -Id: properties as under Start-JIMSchedule.
Progress and Steps answer different questions. Steps has one entry per Schedule Step; Progress counts step groups, where steps that run at the same time are one group, so a Schedule of six steps where two run together is five steps long:
| Property | Description |
|---|---|
Progress.CurrentStepNumber |
The step group being run, 1-based. |
Progress.TotalSteps |
How many step groups the Schedule has. |
Progress.Steps |
One entry per step group, each with its StepIndex, Name, Status (Pending, Running, Completed, Failed or Cancelled), IsParallel, and TaskStatuses, every concurrent task's own outcome. |
Steps.CancellationReason |
Why a Cancelled step did not run, such as Not run: an earlier step stopped the Schedule.; empty for any other step, including one that was already running when it was cancelled. |
Steps.ContinueOnFailure |
Whether the Schedule Execution carries on past this step if it fails: the step's own setting, or its Schedule's when it follows the Schedule. |
Steps.FailureBehaviourSource |
Where Steps.ContinueOnFailure comes from: Step or Schedule. |
Examples¶
Get-JIMScheduleExecution -Active | Select-Object ScheduleName, StepDisplay
$execution = Get-JIMScheduleExecution -Id "f1e2d3c4-b5a6-7890-abcd-ef1234567890"
$execution.Progress.Steps | Where-Object { $_.IsParallel -and $_.TaskStatuses -contains 'Failed' }
$execution = Get-JIMScheduleExecution -Id "f1e2d3c4-b5a6-7890-abcd-ef1234567890"
$execution.Steps | Where-Object { $_.CancellationReason } | Select-Object StepIndex, Name, CancellationReason
Get-JIMScheduleExecution -ScheduleId "a1b2c3d4-e5f6-7890-abcd-ef1234567890" -Status Failed
Get-JIMScheduleExecution -Status CompleteWithError | Select-Object ScheduleName, CompletedAt, ErrorMessage
Get-JIMSchedule -Name "Weekday Sync" | Get-JIMScheduleExecution -Active
Stop-JIMScheduleExecution¶
Cancels a Schedule Execution that is queued or running.
Syntax¶
It asks for confirmation before it acts: -WhatIf shows what it would do, and -Force or -Confirm:$false skips the prompt.
Parameters¶
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
Id |
guid |
Yes | The unique identifier (GUID) of the Schedule Execution to stop. Accepts pipeline input by property name, Id or ExecutionId. |
|
Force |
switch |
No | Suppresses the confirmation prompt. | |
PassThru |
switch |
No | Returns the cancelled Schedule Execution. |
Output¶
With -PassThru, the cancelled Schedule Execution; otherwise nothing.
Properties as under Start-JIMSchedule.
Examples¶
Stop-JIMScheduleExecution -Id "f1e2d3c4-b5a6-7890-abcd-ef1234567890" -Force
Get-JIMScheduleExecution -ScheduleId "a1b2c3d4-e5f6-7890-abcd-ef1234567890" -Active |
Stop-JIMScheduleExecution -Force
See also¶
- Schedules: create, change and remove Schedules and their steps
- Schedules: what a step failing means, and how a Schedule Execution appears in the portal
- Activities: the Activities each step of a Schedule Execution produces