Name
Get-JobSchedulerOrderHistory
SYNOPSIS
Returns the order execution history for job chains.
SYNTAX
Get-JobSchedulerOrderHistory [[-OrderId] <String>] [[-JobChain] <String>] [[-Directory] <String>] [-Recursive] [[-ExcludeOrder] <String[]>] [[-RegEx] <String>] [[-DateFrom] <DateTime>] [[-DateTo] <DateTime>] [[-RelativeDateFrom] <String>] [[-RelativeDateTo] <String>] [[-Timezone] <TimeZoneInfo>] [[-Limit] <Int32>] [-Successful] [-Failed] [-Incomplete] [<CommonParameters>]
DESCRIPTION
History information is returned for orders from a JobScheduler Master.
Order executions can be selected by job chain, order ID, folder, history status etc.
The history information retured includes start time, end time, return code etc.
PARAMETERS
OrderId
-OrderId <String>
Optionally specifies the identifier of an order to limit results to that order.
This parameter requires use of the -JobChain parameter.
Required? | false |
Position? | 1 |
Default value | |
Accept pipeline input? | true (ByPropertyName) |
Accept wildcard characters? | false |
JobChain
-JobChain <String>
Optionally specifies the path and name of a job chain for which history information is returned.
If the name of a job chain is specified then the -Directory parameter is used to determine the folder.
Otherwise the -JobChain parameter is assumed to include the full path and name of the job chain.
One of the parameters -Directory or -JobChain has to be specified.
Required? | false |
Position? | 2 |
Default value | |
Accept pipeline input? | true (ByPropertyName) |
Accept wildcard characters? | false |
Directory
-Directory <String>
Optionally specifies the folder for which jobs should be returned. The directory is determined
from the root folder, i.e. the "live" directory.
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 -Directory parameter.
By default no sub-folders will be looked up for jobs.
Required? | false |
Position? | named |
Default value | False |
Accept pipeline input? | true (ByPropertyName) |
Accept wildcard characters? | false |
ExcludeOrder
-ExcludeOrder <String[]>
This parameter accepts a single job chain path or an array of job chain paths that are excluded from the results.
Optionally the job chain path can be appended an order ID separated by a semicolon.
Required? | false |
Position? | 4 |
Default value | |
Accept pipeline input? | true (ByPropertyName) |
Accept wildcard characters? | false |
RegEx
-RegEx <String>
Specifies a regular expression that filters the orders to be returned.
The regular expression is applied to the path and ID of orders.
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: Begin 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, 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? | 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, 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? | 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-JSOrderHistory -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-JSOrderHistory -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 |
Limit
-Limit <Int32>
Specifies the max. number of history items for order executions to be returned.
The default value is 10000, for an unlimited number of items the value -1 can be specified.
Required? | false |
Position? | 11 |
Default value | 0 |
Accept pipeline input? | true (ByPropertyName) |
Accept wildcard characters? | false |
Successful
-Successful <SwitchParameter>
Returns history information for successfully completed orders.
Required? | false |
Position? | named |
Default value | False |
Accept pipeline input? | true (ByPropertyName) |
Accept wildcard characters? | false |
Failed
-Failed <SwitchParameter>
Returns history information for failed orders.
Required? | false |
Position? | named |
Default value | False |
Accept pipeline input? | true (ByPropertyName) |
Accept wildcard characters? | false |
Incomplete
-Incomplete <SwitchParameter>
Specifies that history information for running orders should be returned.
Required? | false |
Position? | named |
Default value | False |
Accept pipeline input? | true (ByPropertyName) |
Accept wildcard characters? | false |
RELATED LINKS
EXAMPLES
-------------------------- EXAMPLE 1 --------------------------
PS > $items = Get-JobSchedulerOrderHistory
Returns today's order execution history for any orders.
-------------------------- EXAMPLE 2 --------------------------
PS > $items = Get-JobSchedulerOrderHistory -RegEx '^/sos'
Returns today's order execution history for any orders from the /sos folder.
-------------------------- EXAMPLE 3 --------------------------
PS > $items = Get-JobSchedulerOrderHistory -RegEx 'report'
Returns today's order execution history for orders that contain the string 'report' in the order's path.
-------------------------- EXAMPLE 4 --------------------------
PS > $items = Get-JobSchedulerOrderHistory -Timezone (Get-Timezone)
Returns today's order execution history for any orders with dates being converted to the local timezone.
-------------------------- EXAMPLE 5 --------------------------
PS > $items = Get-JobSchedulerOrderHistory -Timezone (Get-Timezone -Id 'GMT Standard Time')
Returns today's order execution history for any orders with dates being converted to the GMT timezone.
-------------------------- EXAMPLE 6 --------------------------
PS > $items = Get-JobSchedulerOrderHistory -JobChain /sos/dailyplan/CreateDailyPlan
Returns today's order execution history for a given job chain.
-------------------------- EXAMPLE 7 --------------------------
PS > $items = Get-JobSchedulerOrderHistory -ExcludeOrder /sos/dailyplan/CreateDailyPlan, /sos/notification/SystemNotifier:MonitorSystem
Returns today's order execution history for any orders excluding orders from the specified job chain paths. The job chain path '/sos/notification/SystemNotifier' is appended the order ID 'MonitorSystem' separated by a semicolon to indicate that the specified order ID only is excluded from the results.
-------------------------- EXAMPLE 8 --------------------------
PS > $items = Get-JobSchedulerOrderHistory -Successful -DateFrom "2020-08-11 14:00:00Z"
Returns the order execution history for successfully completed orders that started after the specified UTC date and time.
-------------------------- EXAMPLE 9 --------------------------
PS > $items = Get-JobSchedulerOrderHistory -Failed -DateFrom (Get-Date -Hour 0 -Minute 0 -Second 0).AddDays(-7).ToUniversalTime()
Returns the order execution history for any failed orders for the last seven days.
-------------------------- EXAMPLE 10 --------------------------
PS > $items = Get-JobSchedulerOrderHistory -RelativeDateFrom -7d
Returns the order execution history for the last seven days. The history is reported starting from midnight UTC.
-------------------------- EXAMPLE 11 --------------------------
PS > $items = Get-JobSchedulerOrderHistory -RelativeDateFrom -7d+01:00
Returns the order execution history for the last seven days. The history is reported starting from 1 hour after midnight UTC.
-------------------------- EXAMPLE 12 --------------------------
PS > $items = Get-JobSchedulerOrderHistory -RelativeDateFrom -7d+TZ
Returns the order execution history 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-JobSchedulerOrderHistory -RelativeDateFrom -1w
Returns the order execution history for any jobs for the last week.
-------------------------- EXAMPLE 14 --------------------------
PS > $items = Get-JobSchedulerOrderHistory -Directory /sos -Recursive -Successful -Failed
Returns today's order execution history for any completed orders from the "/sos" directory and any sub-folders recursively.