Language: PowerShell
View on GitHub to download or comment.
See the Client API Examples Introduction for additional information and prerequisites.
This PowerShell script uses the adTempus API to query the history for selected jobs and write the history to a CSV file.
Modify the property list in select-object (line 22) to include additional properties for the instances.
param (
[string]$server = ".",
[string]$job = "*",
[datetime]$start=,
[datetime]$end,
[Parameter(Mandatory)]
[string]$output
)
add-type -path "c:\program files\arcana development\adtempus\4.0\ArcanaDevelopment.adTempus.Client.dll"
$adtempus=[ArcanaDevelopment.adTempus.Client.Scheduler]::Connect($server,[ArcanaDevelopment.adTempus.Shared.LoginAuthenticationType]::Windows,"","")
$context=$adtempus.NewDataContext()
$parms = New-Object ArcanaDevelopment.adTempus.Shared.InstanceQueryParameters
$parms.StartTimestamp = $start
$parms.EndTimestamp = $end
$context.GetJobs($job) | ForEach-Object {$parms.TargetObjects.Add($_.OID)}
$context.GetJobHistory($parms) | select-object -property @{Name='FullName';Expression={$_.Job.FullyQualifiedName}},@{Name='JobName';Expression={$_.Job.Name}},InstanceID,ExecutionStart,ExecutionFinish,Status | Sort-Object -property FullyQualifiedName | export-csv -Path $output
$context.Dispose()
$adTempus.Dispose()
View on GitHub to comment.