...
Get-JobSchedulerTaskHistory [[-Job] <String>] [[-JobChain] <String>] [[-OrderId] <String>] [[-Directory] <String>] [-Recursive] [[-State] <String>] [[-ExcludeJob] <String[]>] [[-RegEx] <String>] [[-DateFrom] <DateTime>] [[-DateTo] <DateTime>] [[-RelativeDateFrom] <String>] [[-RelativeDateTo] <String>] [[-Timezone] <TimeZoneInfo>] [[-TaskId] <Int32[]>] [[-Limit] <Int32>] [-Successful] [-Failed] [-Incomplete] [<CommonParameters>]
...
-State <String>
Specifies that only jobs are considered that an order is currently passing. This is identified by the
order's state attribute that corresponds to the job node's state attribute.
This parameter requires use of the -JobChain parameter. If used with the -Order OrderId parameter then
only jobs for that order are considered, otherwise jobs for any orders in the given job chain are considered.
Required? | false |
Position? | 5 |
Default value | |
Accept pipeline input? | true (ByPropertyName) |
Accept wildcard characters? | false |
ExcludeJob
-ExcludeJob <String[]>
This parameter accepts a single job path or an array of job paths that are excluded from the results.
Required? | false |
Position? | 6 |
Default value | |
Accept pipeline input? | true (ByPropertyName) |
Accept wildcard characters? | false |
RegEx
-RegEx <String>
Specifies a regular expression that filters the jobs to be returned.
The regular expression is applied to the path and name of jobs.
Required? | false |
Position? | 7 |
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: Begin of the current day as a UTC date
Required? | false |
Position? | 68 |
Default value | (Get-Date -Hour 0 -Minute 0 -Second 0).ToUniversalTime() |
Accept pipeline input? | true (ByPropertyName) |
Accept wildcard characters? | false |
...
-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? | 79 |
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, that 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? | 10 |
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, that 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? | 11 |
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 JobScheduler 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? | 812 |
Default value | (Get-Timezone -Id 'UTC') |
Accept pipeline input? | true (ByPropertyName) |
Accept wildcard characters? | false |
TaskId
-TaskId <Int32[]>
Required? | false |
Position? | 13 |
Default value | |
Accept pipeline input? | true (ByPropertyName) |
Accept wildcard characters? | false |
...
-Limit <Int32>
Specifies the max. number of history items of 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? | 914 |
Default value | 0 |
Accept pipeline input? | true (ByPropertyName) |
Accept wildcard characters? | false |
...
-Successful <SwitchParameter>
Returns history information for successfully executed completed tasks.
Required? | false |
Position? | named |
Default value | False |
Accept pipeline input? | true (ByPropertyName) |
Accept wildcard characters? | false |
...
-Failed <SwitchParameter>
Returns history informiaton information for failed tasks.
Required? | false |
Position? | named |
Default value | False |
Accept pipeline input? | true (ByPropertyName) |
Accept wildcard characters? | false |
...
Required? | false |
Position? | named |
Default value | False |
Accept pipeline input? | true (ByPropertyName) |
Accept wildcard characters? | false |
RELATED LINKS
about_jobschedulerJobScheduler
EXAMPLES
-------------------------- EXAMPLE 1 --------------------------
...
-------------------------- EXAMPLE 2 --------------------------
PS > $items = Get-JobSchedulerTaskHistory -RegEx '^/sos'
Returns today's task execution history for any jobs from the /sos folder.
-------------------------- EXAMPLE 3 --------------------------
PS > $items = Get-JobSchedulerTaskHistory -RegEx 'report'
Returns today's task execution history for jobs that contain the string 'report' in the job path.
-------------------------- EXAMPLE 4 --------------------------
PS > $items = Get-JobSchedulerTaskHistory -Timezone (Get-Timezone)
Returns today's task execution history for any jobs with dates being converted to the local timezone.
-------------------------- EXAMPLE 3 5 --------------------------
...
-------------------------- EXAMPLE 4 6 --------------------------
PS > $items = Get-JobSchedulerTaskHistory -Job /testsos/globalsdailyplan/job1CreateDailyPlan
Returns today's task execution history for a given job.
-------------------------- EXAMPLE 5 7 --------------------------
PS > $items = Get-JobSchedulerTaskHistory -JobChain /testsos/globalsdailyplan/job_chain1CreateDailyPlan
Returns today's task execution history for jobs in the given job chain.
-------------------------- EXAMPLE 8 --------------------------
PS > $items = Get-JobSchedulerTaskHistory -ExcludeJob /sos/dailyplan/CreateDailyPlan, /sos/housekeeping/scheduler_rotate_log
Returns today's task execution history for any jobs excluding the specified job paths.
-------------------------- EXAMPLE 9 --------------------------
PS > $items = Get-JobSchedulerTaskHistory -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 10 6 --------------------------
...
-------------------------- EXAMPLE 11 --------------------------
PS > $items = Get-JobSchedulerTaskHistory -RelativeDateFrom -7d
Returns the task execution history for the last seven days. The history is reported starting from midnight UTC.
-------------------------- EXAMPLE 12 --------------------------
PS > $items = Get-JobSchedulerTaskHistory -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 13 --------------------------
PS > $items = Get-JobSchedulerTaskHistory -RelativeDateFrom -7d+TZ
Returns the task execution history for any 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 14 --------------------------
PS > $items = Get-JobSchedulerTaskHistory -RelativeDateFrom -1w
Returns the task execution history for the last week.
-------------------------- EXAMPLE 15 7 --------------------------
PS > $items = Get-JobSchedulerTaskHistory -Directory /test sos -Recursive -Succesful Successful -Failed
Returns today's task execution history for any completed tasks from the "/testsos" directory and any sub-folders recursively.