Table of Contents

Class Script

Namespace
ArcanaDevelopment.adTempus.Client
Assembly
ArcanaDevelopment.adTempus.Client.dll

Represents a script stored in adTempus

public sealed class Script : ADTIndependentObject
Inheritance
object
Script

Properties

CaptureOutput

Indicates whether the output from the script should be saved as a CapturedFile in the job history.

public bool CaptureOutput { get; set; }

Property Value

bool

Remarks

Output can be captured only for PowerShell scripts. This option is ignored for other scripts.

ClassID

The Class ID for the object

[IgnoreDataMember]
public override ClassID ClassID { get; }

Property Value

ClassID

ClassKeyName

The key name for the class.

public override string ClassKeyName { get; }

Property Value

string

Remarks

This name the name used by adTempus to identify the class and is intended for programmatic use only. Use the ClassName for a user-friendly name.

IncludeLibraries

The Script Libraries referenced by the script

public ScriptLibraryCollection IncludeLibraries { get; }

Property Value

ScriptLibraryCollection

Remarks

If the script references code contained in any Script Libraries, those libraries must be added to the IncludeLibraries collection.

IncludeScripts

Additional scripts to be deployed when this script is executed.

public ScriptCollection IncludeScripts { get; }

Property Value

ScriptCollection

Remarks

IncludeScripts are used only when the script is a batch file or PowerShell script. Any scripts referenced in IncludeScripts are written out to the ADTJobTemp directory when the target script is executed.

IsDependent

Indicates whether the object is a dependent of (owned by) another object

[IgnoreDataMember]
public override bool IsDependent { get; }

Property Value

bool

Remarks

An independent object (IsDependent is false) is an object that can exist on its own without being part of another object. For example, Jobs, Job Groups, etc.

A dependent object (IsDependent is true) is a part of another object. For example, a JobStep cannot exist independently of a Job, so the JobStep is dependent.

Dependent objects cannot be directly fetched from the server: they are only fetched as part of the object they belong to. They also cannot be saved or deleted independently: they are automatically saved or deleted when the owning object is saved or deleted.

MaxRunTime

The maximum time (in seconds) this script is allowed to run

public int MaxRunTime { get; set; }

Property Value

int

Remarks

Set to 0 for no limit

If the MaxRunTime is exceeded, adTempus will terminate the script.

Name

The name of the script

public string Name { get; set; }

Property Value

string

Remarks

The name is required if Shared is true, optional otherwise. For a shared script, the Name must be unique across all other shared scripts.

References

List of assemblies referenced by the script.

public string References { get; set; }

Property Value

string

Remarks

For .NET scripts that need to reference additional assemblies, specify those assemblies here. The list should be comma-, semicolon-, or newline-delimited.

RunIsolated

Indicates whether the script should be run by in an isolated instance of the script hosting process.

public bool RunIsolated { get; set; }

Property Value

bool

Remarks

If true, the script is hosted in its own instance of the script hosting process. If false (the default) it may share the host process with other scripts being run for the same user.

ScriptBody

The body (code) for the script

public string ScriptBody { get; set; }

Property Value

string

Remarks

The ScriptBody must be a valid script in the ScriptLanguage specified for the script.

ScriptLanguage

The language used for this script

public string ScriptLanguage { get; set; }

Property Value

string

Remarks

Must be set to one of the string constants defined in ScriptLanguages.

ScriptOptions

Additional options for script execution

public ScriptOptions ScriptOptions { get; set; }

Property Value

ScriptOptions

Shared

Indicates whether the script is shared and can be reused

public bool Shared { get; set; }

Property Value

bool

Remarks

If the script is not shared, it belongs to the object it is assigned to (ScriptExecutionTask, ScriptAction, etc.) and is deleted when the owning object is deleted. You must not assign a non-shared script to more that one object.

If the script is shared it exists independently of the objects it is assigned to, and can be assigned to be used by any number of objects. If those objects are deleted, the script remains.

Once a script is saved with Shared set to true it cannot be unshared by setting Shared back to false.

To retrieve existing Shared Scripts, use GetSharedScript(string), DataContext.GetSharedScripts, or GetObject(OID). Non-shared scripts cannot be retrieved directly but only as part of the object that owns them.

Use32BitHost

Indicates whether this script should be run by the 32-bit script host.

public bool Use32BitHost { get; set; }

Property Value

bool

Remarks

Setting/clearing Use32BitHost is equivalent to setting/clearing the Use32BitHost flag in ScriptOptions.

The 32-bit host is automatically used for Windows Script Host scripts (VBScript, JScript). All others use the 64-bit host by default unless this option is set.

Methods

FindOwningObject()

Get the owner of this object based on relationships.

protected override ADTObject FindOwningObject()

Returns

ADTObject

The owning object, or null if the object is not owned by another object or the owner has not been set.

GetObjectDescription()

Gets a description of the object's key settings.

protected override string GetObjectDescription()

Returns

string

Remarks

This method is called by GetDescription() to get a user-friendly description of the object (such as its key settings) for display to the user. The description should contain enough information to distinguish this object from others of the same class.

TestScript(CredentialProfile)

Executes the script to test it.

public MessageCollection TestScript(CredentialProfile credentials)

Parameters

NameTypeDescription
credentials CredentialProfile

Optional CredentialProfile representing the identity to run the script under. If no profile is provided, the client identity is used. The caller must have Use permission for the profile.

Returns

MessageCollection

A collection of messages containing any messages from the execution. If execution was successful, an informational message will be included.

ValidateScript(CredentialProfile)

Validates the script by compiling it and checking for errors.

public MessageCollection ValidateScript(CredentialProfile credentials)

Parameters

NameTypeDescription
credentials CredentialProfile

Optional CredentialProfile representing the identity to validate the script under. If no profile is provided, the client identity is used. The caller must have Use permission for the profile.

Returns

MessageCollection

A collection of messages containing any validation warning or errors. If validation was successful, an informational message will be included.

WriteToConfigurationReport(IADTObjectConfigurationReportWriter)

Writes the object and any contained objects to a configuration report

public override void WriteToConfigurationReport(IADTObjectConfigurationReportWriter reportBuilder)

Parameters

NameTypeDescription
reportBuilder IADTObjectConfigurationReportWriter

The report builder to write the object to.

Inherited Members