Skip to content

Instantly share code, notes, and snippets.

@ArcanaBill
ArcanaBill / 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

@ArcanaBill
ArcanaBill / 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.
@ArcanaBill
ArcanaBill / 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.

@ArcanaBill
ArcanaBill / 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)
@ArcanaBill
ArcanaBill / 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.

@ArcanaBill
ArcanaBill / readme.md
Last active February 6, 2025 22:05
Set a new password for a Credential Profile #adTempus #api #version4 #powershell

This PowerShell script uses the adTempus API to retrieve a Credential Profile and set a new password for it.

Usage: .\set-adtcredentialpassword -account userid -newpassword password

@ArcanaBill
ArcanaBill / readme.md
Last active February 15, 2023 18:39
Map a drive letter to a UNC path for a job #adTempus #api #version4

This fragment demonstrates how to add a mapped network drive to a job

This code creates a NetworkConnection resource to map a drive letter to a UNC path for use within the job.

@ArcanaBill
ArcanaBill / get-ADTJobHistory.ps1
Last active July 22, 2022 18:39
Query job history and write to a CSV file #adTempus #api #version4 #powershell
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"
@ArcanaBill
ArcanaBill / readme.md
Last active April 28, 2022 21:26
Using the adTempus API from Python #adTempus #api #version4

This sample demonstrates how to use the adTempus API from Python.

Background and Requirements

The adTempus API is only available as a .NET assembly, but can be referenced from Python by using Python.NET.

Refer to the Python.NET documentation for installation instructions. Once Python.NET is installed, your Python code can reference the adTempus client assembly as shown below.

@ArcanaBill
ArcanaBill / readme.md
Created November 29, 2021 15:01
Get dates for a Holiday Set #adTempus #api #version4

This script demonstrates how to retrieve a Holiday Set and get a list of the holiday dates that it defines