Name

Get-JS7TaskHistory

SYNOPSIS

Returns the task execution history for jobs

SYNTAX

Get-JS7TaskHistory [[-Job] <String>] [[-WorkflowPath] <String>] [[-Folder] <String>] [-Recursive] [[-ExcludeJob] <Hashtable>] [[-JobName] <String>] [[-DateFrom] <DateTime>] [[-DateTo] <DateTime>] [[-RelativeDateFrom] <String>] [[-RelativeDateTo] <String>] [[-Timezone] <TimeZoneInfo>] [[-TaskId] <Int32>] [[-Limit] <Int32>] [-NormalCriticality] [-MinorCriticality] [-MajorCriticality] [-Successful] [-Failed] [-InProgress] [<CommonParameters>]

DESCRIPTION

History information is returned for jobs from a JS7 Controller.
Task executions can be selected by job name, workflow, folder, history status etc.

The history information retured includes start time, end time, return code etc.

The following REST Web Service API resources are used:

* /tasks/history

PARAMETERS

Job

-Job <String>
Optionally specifies the name of a job for which task execution results are reported.

This parameter requires use of the -WorkflowPath parameter to specify the workflow
that includes the job.

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

WorkflowPath

-WorkflowPath <String>
Optionally specifies the path and name of a workflow that includes jobs
for which the task history is reported. The task execution history optionally can futher
be limited by specifying the -Job parameter to limit results to a job in the given workflow.

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

Folder

-Folder <String>
Optionally specifies the folder that includes workflows for which the task history should be returned.

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

Recursive

-Recursive <SwitchParameter>
Specifies that any sub-folders should be looked up when used with the -Folder parameter.
By default no sub-folders will be looked up for jobs.

Required?false
Position?named
Default valueFalse
Accept pipeline input?true (ByPropertyName)
Accept wildcard characters?false

ExcludeJob

-ExcludeJob <Hashtable>
This parameter accepts a hashmap of job names and optionally workflow paths that are excluded from results.
If a workflow path is specified then all jobs of the given workflow are excluded.

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

JobName

-JobName <String>
Specifies the name of a job that is looked up by use of * and ? wildcard characters:

* : match zero or more characters
? : match any single character

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

DateFrom

-DateFrom <DateTime>
Specifies the date starting from which history items should be returned.
Consider that a UTC date has to be provided.

Default: Beginning of the current day as a UTC date

Required?false
Position?6
Default value(Get-Date -Hour 0 -Minute 0 -Second 0).ToUniversalTime()
Accept pipeline input?true (ByPropertyName)
Accept wildcard characters?false

DateTo

-DateTo <DateTime>
Specifies the date until which history items should be returned.
Consider that a UTC date has to be provided.

Default: End of the current day as a UTC date

Required?false
Position?7
Default value(Get-Date -Hour 0 -Minute 0 -Second 0).AddDays(1).ToUniversalTime()
Accept pipeline input?true (ByPropertyName)
Accept wildcard characters?false

RelativeDateFrom

-RelativeDateFrom <String>
Specifies a relative date starting from which history items should be returned, e.g.

* -1s, -2s: one second ago, two seconds ago
* -1m, -2m: one minute ago, two minutes ago
* -1h, -2h: one hour ago, two hours ago
* -1d, -2d: one day ago, two days ago
* -1w, -2w: one week ago, two weeks ago
* -1M, -2M: one month ago, two months ago
* -1y, -2y: one year ago, two years ago

Optionally a time offset can be specified, e.g. -1d+02:00, as otherwise midnight UTC is assumed.
Alternatively a timezone offset can be added, e.g. by using -1d+TZ. This is calculated by the cmdlet
for the timezone that is specified with the -Timezone parameter.

This parameter takes precedence over the -DateFrom parameter.

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

RelativeDateTo

-RelativeDateTo <String>
Specifies a relative date until which history items should be returned, e.g.

* -1s, -2s: one second ago, two seconds ago
* -1m, -2m: one minute ago, two minutes ago
* -1h, -2h: one hour ago, two hours ago
* -1d, -2d: one day ago, two days ago
* -1w, -2w: one week ago, two weeks ago
* -1M, -2M: one month ago, two months ago
* -1y, -2y: one year ago, two years ago

Optionally a time offset can be specified, e.g. -1d+02:00, as otherwise midnight UTC is assumed.
Alternatively a timezone offset can be added, e.g. by using -1d+TZ. This is calculated by the cmdlet
for the timezone that is specified with the -Timezone parameter.

This parameter takes precedence over the -DateFrom parameter.

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

Timezone

-Timezone <TimeZoneInfo>
Specifies the timezone to which dates should be converted in the history information.
A timezone can e.g. be specified like this:

Get-JSTaskHistory -Timezone (Get-Timezone -Id 'GMT Standard Time')

All dates in JS7 are UTC and can be converted e.g. to the local time zone like this:

Get-JSTaskHistory -Timezone (Get-Timezone)

Default: Dates are returned in UTC.

Required?false
Position?10
Default value(Get-Timezone -Id 'UTC')
Accept pipeline input?true (ByPropertyName)
Accept wildcard characters?false

TaskId

-TaskId <Int32>
Specifies that the execution history should only be reported for the given task ID.

Required?false
Position?11
Default value0
Accept pipeline input?true (ByPropertyName)
Accept wildcard characters?false

Limit

-Limit <Int32>
Specifies the max. number of history items for task executions to be returned.
The default value is 10000, for an unlimited number of items the value -1 can be specified.

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

NormalCriticality

-NormalCriticality <SwitchParameter>
Specifies that the task history should only be returned for jobs that are assigned a "normal" criticality.

Required?false
Position?named
Default valueFalse
Accept pipeline input?true (ByPropertyName)
Accept wildcard characters?false

MinorCriticality

-MinorCriticality <SwitchParameter>
Specifies that the task history should only be returned for jobs that are assigned a "minor" criticality.

Required?false
Position?named
Default valueFalse
Accept pipeline input?true (ByPropertyName)
Accept wildcard characters?false

MajorCriticality

-MajorCriticality <SwitchParameter>
Specifies that the task history should only be returned for jobs that are assigned a "major" criticality.

Required?false
Position?named
Default valueFalse
Accept pipeline input?true (ByPropertyName)
Accept wildcard characters?false

Successful

-Successful <SwitchParameter>
Returns history information for successfully completed tasks.

Required?false
Position?named
Default valueFalse
Accept pipeline input?true (ByPropertyName)
Accept wildcard characters?false

Failed

-Failed <SwitchParameter>
Returns history information for failed tasks.

Required?false
Position?named
Default valueFalse
Accept pipeline input?true (ByPropertyName)
Accept wildcard characters?false

InProgress

-InProgress <SwitchParameter>
Specifies that history information for running tasks should be returned.

Required?false
Position?named
Default valueFalse
Accept pipeline input?true (ByPropertyName)
Accept wildcard characters?false

about_JS7

EXAMPLES

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

PS > $items = Get-JS7TaskHistory

Returns today's task execution history for any jobs.

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

PS > $items = Get-JS7TaskHistory -JobName "*sos*"

Returns today's task execution history for all jobs with a job name that includes "sos".

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

PS > $items = Get-JS7TaskHistory -Timezone (Get-Timezone)

Returns today's task execution history for all jobs with dates being converted to the local timezone.

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

PS > $items = Get-JS7TaskHistory -Timezone (Get-Timezone -Id 'GMT Standard Time')

Returns today's task execution history for all jobs with dates being converted to the GMT timezone.

-------------------------- EXAMPLE 5 --------------------------

PS > $items = Get-JS7TaskHistory -Job /sos/dailyplan/CreateDailyPlan

Returns today's task execution history for a given job.

-------------------------- EXAMPLE 6 --------------------------

PS > $items = Get-JS7TaskHistory -WorkflowPath /some_path/some_workflow

Returns today's task execution history for jobs in the given workflow.

-------------------------- EXAMPLE 7 --------------------------

PS > $items = Get-JS7TaskHistory -ExcludeJob @{ 'workflowPath'='/some_path/some_workflow'; 'job'='some_job' }

Returns today's task execution history for all jobs excluding the specified workflow paths and job names.

-------------------------- EXAMPLE 8 --------------------------

PS > $items = Get-JS7TaskHistory -Successful -DateFrom "2020-08-11 14:00:00Z"

Returns the task execution history for successfully completed jobs that started after the specified UTC date and time.

-------------------------- EXAMPLE 9 --------------------------

PS > $items = Get-JS7TaskHistory -Failed -DateFrom (Get-Date -Hour 0 -Minute 0 -Second 0).AddDays(-7).ToUniversalTime()

Returns the task execution history for all failed jobs for the last seven days.

-------------------------- EXAMPLE 10 --------------------------

PS > $items = Get-JS7TaskHistory -RelativeDateFrom -7d

Returns the task execution history for the last seven days. The history is reported starting from midnight UTC.

-------------------------- EXAMPLE 11 --------------------------

PS > $items = Get-JS7TaskHistory -RelativeDateFrom -7d+01:00

Returns the task execution history for the last seven days. The history is reported starting from 1 hour after midnight UTC.

-------------------------- EXAMPLE 12 --------------------------

PS > $items = Get-JS7TaskHistory -RelativeDateFrom -7d+TZ

Returns the task execution history for all jobs for the last seven days. The history is reported starting from midnight in the same timezone that is used with the -Timezone parameter.

-------------------------- EXAMPLE 13 --------------------------

PS > $items = Get-JS7TaskHistory -RelativeDateFrom -1w

Returns the task execution history for the last week.

-------------------------- EXAMPLE 14 --------------------------

PS > $items = Get-JS7TaskHistory -Folder /sos -Recursive -Successful -Failed

Returns today's task execution history for all completed tasks from the "/sos" folder and any sub-folders recursively.

  • No labels