Skip to content

Instantly share code, notes, and snippets.

@ArcanaDev
ArcanaDev / readme.md
Created January 9, 2026 17:39
Acknowledge all failed instances of a job when the job succeeds #adtempus #version4 #userscript

This script acknowledges all failed instances for the executing job. It can be used to automatically acknowledge previous failures for the job when the job succeeds

Usage

Note: The user account the job is running under must have an adTempus login with permission to execute the job. This is necessary so the API can acknowledge the instances.

Create a new Shared Script named "Acknowledge all instance for executing job". Set the language to C# and paste in the sample code as the script body. Click OK to save the script.

Edit the job where you want to use the script. Add a Response with an event to trigger it on successful exection. Add a script action and select the new Shared Script as the script to execute.

When the job succeeds and the script is invoked, it gets the identity of the job, then uses the API to fetch the job and acknowledge all failed instances.

@ArcanaDev
ArcanaDev / readme.md
Last active January 8, 2026 17:38
Include warning and error messages from Job Log in notification messages #adtempus #version4 #userscript

This script allows you to include warning and error messages logged in the Job Log when sending a notification message for the job. For example, if you have a Response to send a notification when the job fails, you can use this script to include more detailed information from the Job Log.

How it Works

This script uses the adTempus API to get information about the executing job instance. It reads the Job Log messages for the instance to find all warning and error messages. It combines these messages into a single string, which it stores in the "ErrorMessagesForInstance" Job Variable. This variable can be used to insert the messages where you want them to appear.

Note: The user account the job is running under must have an adTempus login with permission to read the job. This is necessary so the API can read the job details.

Usage

Create a new Shared Script named "Copy error and warning messages to variable". Set the language to C# and paste the sample code as the script body. Click OK to save

@ArcanaDev
ArcanaDev / readme.md
Last active January 7, 2026 21:34
Send a notification message when held jobs are found #adtempus #version4 #userscript

This script can be used to send a notification message when jobs are found that have been put on hold.

Each time the script runs it creates a list of all held jobs, and stores this list in a file. It compares the list to the list from the previous run of the script to detect jobs that have been held since the last script run.

The script then places a list of the newly-held jobs in a Job Variable named "NewlyHeldJobs" and tells adTempus to execute the on-demand Response with the tag "NotifyForHeldJobs".

Usage

Create a new job. The user account used for the job must be an account that has permission to connect to adTempus and read all jobs.

Schedule the job to run at an appropriate interval.

@ArcanaDev
ArcanaDev / readme.md
Last active December 8, 2025 18:48
List jobs using a history retention setting other than the default #adtempus #version4 #sql

This query lists all jobs that are configured to use a history retention setting other than the instance default setting, showing what the setting is for each job. The default setting is configured in Configuration>General Server Options.

@ArcanaDev
ArcanaDev / readme.md
Created September 25, 2025 16:59
Use API to get information on current job instance #adtempus #version4 #userscript

This script uses the adTempus API to get an ExecutionHistoryItem representing the job instance in which the script is running. You can use this to get detailed information about the instance and its steps. In this example the script logs messages giving the status for each step that has executed so far.

@ArcanaDev
ArcanaDev / readme.md
Last active February 6, 2025 22:06
Set a new password for a File Server definition #adTempus #api #version4 #powershell

This PowerShell script uses the adTempus API to retrieve a File Server definition and set a new password for it.

Usage: .\set-ADTFileServerPassword -fileServer serverName -newpassword password

@ArcanaDev
ArcanaDev / readme.md
Last active February 4, 2025 17:46
Set a job variable to the last business day of the prior month #adtempus #version4 #userscript

This script can be run by an adTempus script task to set a Job Variable to the last business day of the month prior to when the script is run.

It sets the job variable "LastBusinessDayOfPriorMonth" to this date in yyyy-MM-dd format.

The script excludes Saturdays, Sundays, and holidays when looking for the last business day.

There are three versions:

  • Sample 1 uses the holiday set configured for the calling job. It does this by looking at the enabled schedule triggers for the calling job and taking the first holiday set it finds.
  • Sample 2 always uses a specified holiday set. In the example it's "Standard U.S. Holidays"; change the name if you use a different set.
  • Sample 3 ignores holidays. This version will work for you if you never have a holiday in the last 3 days of the month.
@ArcanaDev
ArcanaDev / readme.md
Last active September 24, 2024 14:41
Set Job Variables from values in a trigger file #adtempus #version4 #userscript

This script can be used if you want to trigger a job using a file and set Job Variables from values in the file.

To use the script, create a new Shared Script in adTempus using C# as the language and this script as the script body. In your job, configure the File Trigger as normal and add a Script Execution Task as the first step of the job to run the Shared Script.

The script gets the name of the trigger file, reads it, and sets the variables.

@ArcanaDev
ArcanaDev / example.cs
Last active January 15, 2024 18:02
Set Job Variables when submitting a job for execution #adTempus #api #version5
//Connect to the local adTempus server, using Windows authentication.
using (var connection = Scheduler.Connect())
{
//Create a DataContext to work in. All object operations take place within this context.
//Use a Using block so the context is disposed when we finish with it
using (var context = connection.NewDataContext())
{
//Fetch the job named "My Test Job"
var job = context.GetJob("My Test Job");
if (null == job)
@ArcanaDev
ArcanaDev / readme.md
Last active November 13, 2023 21:29
List email notification recipients for Jobs #adtempus #sql #version4

This SQL script lists the names and addresses of all Notification Recipients used by Notification Actions in Responses defined for Jobs and Job Steps and for Notification Tasks within jobs.