Table of Contents

Find jobs not run in the last X days

This PowerShell script uses the adTempus API to find all jobs on an adTempus server that have not been run within the last x days, or that have never been run at all.

Use the -days parameter to specify x (default is 180).

Use -server to connect to an adTempus instance other than the local instance.

See this forum post for more information.

param (
    [string]$server = ".",
    [int]$days = 180
 )
add-type -path "c:\program files\arcana development\adtempus\4.0\ArcanaDevelopment.adTempus.Client.dll"

$cutoffDate=[DateTime]::UtcNow.Subtract([TimeSpan]::FromDays($days))
$adtempus=[ArcanaDevelopment.adTempus.Client.Scheduler]::Connect($server,[ArcanaDevelopment.adTempus.Shared.LoginAuthenticationType]::Windows,"","")
$context=$adtempus.NewDataContext()
$restartPaging=$false

$context.GetJobs("*",[ArcanaDevelopment.adTempus.Shared.ObjectFetchOptions]::StubsOnly,0,[ref] $restartPaging)   | 
Select-Object Name,@{n="GroupName";e={if($_.Group.IsRootGroup) {""} else{$_.Group.FullyQualifiedName}}},@{n="LastStart";e={$_.JobStatus.ExecutionStart}},@{n="JobId";e={$_.OID.ObjectID}}    |
Sort-Object -Property GroupName,Name