Skip to main content

Overview

A workflow is a YAML or JSON document containing step-based actions or tasks that must be performed by a processing engine. It aids development by providing a simple method of chaining discrete tasks without the need to write expansive functions. At the highest level in the workflow document are tasks and below it are the task’s arguments. In the example workflow above, the first properties of the workflow document are two tasks named taskOne and taskTwo . Both tasks are of the log type and will print a line to the debug log. However, each task will print a unique message specified by it’s message argument value . For the remainder of this document all workflow examples will be written in YAML as it provides a simpler syntax and the ability to use inline comments. YAML is available in DIRECT 6.1 or higher and older versions of DirectGVR must use JSON.

Chaining tasks

Tasks in a workflow can be chained together and processed. The workflow engine starts processing a task chain by specifying the first task it will run. The name of this task is also known as an entry point .
In the example workflow above, there are two tasks named start and end . The task specified by the start name will be processed first since start is the name of a entry point used by the workflow engine. When the start task completes successfully by printing its message to the debug log, it will run the end task which will print its message to the debug log.

Entry points

The following task names are reserved as specific workflow entry points. Other Reserved Names

SubTasks

Every task can have a success , failure , and complete property that specifies what task should be run next based on the result of the current task. Some task types have additional properties that specify tasks to run. The example below which shows how the stringCompare task has an equalTo property that specifies the task to run when the two strings specified are equal to one another.
Skipping Non-existent Tasks It is possible to skip sub-tasks that do not exist by appending a question mark to the name. The example below shows how the oneTwoCompare task will only run the numbersEqual-{systemShortName} task if it exists in the workflow.
It is also possible to use the question mark suffix in the queue , aggregate , and progress actions sub-tasks.

Managing large workflows

In order to make large workflows easier to manage it is possible to split your tasks into multiple document files. As a requirement your workflow must first be in the YAML format which supports an include array at the root level that contains a list of files or URLs to merge in-to the current document.

Expandable strings

The workflow engine supports expandable strings which are evaluated at run-time. In addition to the core set of expandable strings, the workflow engine also supports these specific strings that are available in certain instances depending on the location specified for the workflow.

Object expansion

Also unique to the workflow engine is the ability to target specific objects to handle string expansion. A target object might be the workflow itself or a particular task. The following keywords are supported that allow you to specify which object you wish to handle the expansion. Examples In the example below, the download task downloads a file specified by it’s url property. When the download is successful, it will the launch task which will launch the file specified by it’s parent task’s outputPath status property.

Tasks

Required arguments are bold in the arguments list. All tasks can have the following reserved arguments:

Error handling

When a task has an error it will bubble up to all the tasks that ran before it unless the ignoreError task argument is set to true. Tasks are also bubbled up from one workflow to another when called through the workflowRun task.

Task errors

All tasks can return the following errors:

Platform errors

The following error codes are used throughout the workflow engine.

Analytics

When configured in the client, analytics will be sent to the analytics server for routing. An event is queued and sent for each task that gets completed. It contains the following information:
  • Task name
  • Task arguments dictionary
  • Task status dictionary
  • Elapsed time
  • Completion/cancelled state
To prevent secure information from being sent to the analytics system, it is possible to use a private argument/key. An argument name that begins with a . period is private and will not be sent in any analytics event.
In the example above, the url argument would not be sent to analytics. To prevent entire tasks from being sent to the analytics system, it is also possible to specify a private as task by naming it beginning it with a period.

Task types

Below is a list of all the supported task types.

aggregate

Queues a new task constructed from an existing task in the workflow (source) and arguments specified remotely or in the content property (target). Version: 5.1 Arguments: Additional Notes:
  1. url or content arguments are required (not both)
  2. Only used in conjunction with url argument
Changes:
  • 5.2 - Added store argument
  • 6.1 - Removed concurrentTasks argument
Errors: Changes:
  • 5.2 - Removed Aggregate_Error_Request error
Example 1 - Using Multiple Targets workflow.yaml:
items.yaml:
Example 2 - Using Content workflow.yaml:
It is also possible to use a dictionary instead of a list the logSomething inside content if you are only aggregating a single task: Example 3 - Using Target workflow.yaml:
items.yaml:
Example 4 - Using Target and Source workflow.yaml:
items.yaml:
Example 5 - Using Target with JSON workflow.yaml:
items.json:

analytics

Add additional analytics properties to send for every event. Version: 5.1.9 Arguments: Additional Notes:
  1. url or key/value orkeyValuePairs arguments are required (not all)
Changes:
  • 5.2 - Added global argument
Example:
Alternatively, each task supports an analytics section which are additional properties to send for that task event.

certStoreLoad

Load a certificate store valid for this workflow only. Version: 5.2 Arguments: Errors: JWKS Documentation Documentation of the file format can be found at https://auth0.com/docs/jwks Thumbprint List Example: Key is the friendly name of the thumbprint, value is a base64 encoded thumbprint (sha1, sha224, sha256, sha384, sha512 supported)
Example:

directoryCopy

Copies the contents of a directory from one location to another. Version: 5.1.8 Arguments: Changes:
  • 5.2 - Added overwrite argument
Example:

directoryCreate

Creates a directory on the file system. Version: 5.1 Arguments: Example:

directoryMove

Moves the contents of a directory from one location to another. Version: 5.1.8 Arguments: Example:

directoryDelete

Delete a directory from the file system recursively. If the specified directory does not exist, the task will succeed. Version: 5.1 Arguments: Example:

directoryList

Enumerates a directory. Version: 5.2 Arguments: Status Variables: Example:
Recursive Example:

directoryExists

Check if a directory exists on the file system. Version: 5.1 Arguments: Example:

directoryIsEmpty

Check if a directory is empty. Ignores shell browsing metadata files like .DS_Store, thumbs.db, and desktop.ini. Version: 5.1.3 Arguments: Example:

directoryIsWritable

Check if a directory is writable by the current process. Version: 5.1.8 Supported OS:
  • Windows (not supported on UWP)
  • macOS
  • Linux
Arguments: Example:

diskSpaceCheck

Checks the disk space on a certain path. Version: 5.1 Arguments: Example:

dmgMount

Mounts an apple disk image. Version: 5.1 Supported OS:
  • macOS
Arguments: Errors: Example:

dmgUnmount

Unmounts an apple disk image. Version: 5.1 Supported OS:
  • macOS
Arguments: Errors: Example:

download

Downloads a file to disk. Version: 5.1.2 Arguments: Status Variables: Errors: Changes:
  • 5.2 - Added status variables
    • active, skipped, activeTime, pauseTime, canPauseResume, supportResume, supportPause, supportSkip
    • totalBytes, completeBytes, existingBytes
    • responseCode, responseVersion, responseMessage, responseHeaders
  • 5.2 - Added skipTimestamp, overwriteIfNewer, overwriteIfOlder, cookies, and maxRetries arguments
  • 5.2 - Removed json and authenticateJson argument (use JSONRead task instead)
  • 6.0.2 - Added allowHeadRequest argument
Example:

environmentGet

Gets an environment variable for the current process. Version: 6.1 Arguments: Example:

environmentSet

Sets an environment variable for the current process. Version: 6.1 Arguments: Additional Notes:
  1. key /value or keyValuePairs arguments are required (not both)
Example:

error

Sets an error for the current task chain. Alternatively sets the exit code without shutting down. Version: 5.1 Arguments: Example:

fileAuthenticate

Authenticates the signature of a file on disk. Version: 5.1.3 Arguments: Changes:
  • 5.2 - Added store argument
Example:

fileCopy

Copies files from one location to another on disk. Version: 5.1 Arguments: Changes:
  • 6.1 - Added readOnly argument
Example:

fileDelete

Deletes a file from the file system. If the specified file does not exists, the task will succeed. Version: 5.1 Arguments: Example:

fileExists

Check if a file exists on the file system. Version: 5.1 Arguments: Example:

fileHash

Gets or compares the hash of a file on disk. Version: 5.1.3 Arguments: Additional Notes:
  • If expectedDigest is an empty string, the task will complete successfully without equalTo or notEqual sub-actions being called**.**
Status Variables: Changes:
  • 7.0 - Removed MD2 & MD4 hash algorithms.
Example:

fileMove

Moves a file from one location on disk to another. Version: 5.1 Arguments: Example:

jsonRead

Reads values from an json file. Version: 5.1.8 Arguments: Additional Notes:
  1. path or url or content arguments are required (not both)
  2. key /value or keys arguments are required (not both)
Changes:
  • 5.2 - Added store argument
Status Variables: Errors: Changes:
  • 5.2 - Added content argument
  • 5.2 - Added url argument
  • 5.2 - Added JSON_Error_Parse error
Example: JSON:
Workflow:

jsonWrite

Adds or edits values in a json file. Version: 5.1.8 Arguments: Additional Notes:
  1. key /value or keyValuePairs arguments are required (not both)
Errors: Example: JSON:
Workflow:

implode

Deletes the executable for the current process after exiting. Version: 5.1.9 Supported OS:
  • Windows (not supported on UWP)
  • macOS (does nothing)
  • Linux (does nothing)
Example:

iniRead

Reads a value from an ini file. Version: 5.1 Arguments: Additional Notes:
  1. key or keys arguments are required (not both)
Changes:
  • 7.2.108 - Added escape argument
Status Variables: Errors: Example:

iniWrite

Writes a value to an ini file. Version: 5.1 Arguments: Additional Notes:
  1. key /value or keyValuePairs arguments are required (not both)
  2. If the ini file exists, unicode arguement is ignored and the encoding of the existing file is used
Changes:
  • 7.2.108 - Added escape argument
Errors: Example:

interopLoad

Loads an interop library. Version: 5.1 Arguments: Changes:
  • 5.2: Added store argument
Errors: Example:

interopUnload

Unloads an interop library. Version: 5.1 Arguments: Additional Notes:
  1. Must be the same value that was used for interopLoad.
Errors: Example:

launch

Launch an application. Version: 5.1 Supported OS:
  • Windows (not supported on UWP)
  • macOS
  • Linux
Arguments: Status Variables: Errors: Example:

log

Logs a message to the debug log. Version: 5.1 Arguments: Changes:
  • 6.1 - Argument message supports array of strings
Example:

macro

Load macros from a JSON URL or javascript object. Version: 5.1 Arguments: Additional Notes:
  1. url or key/value orkeyValuePairs arguments are required (not all)
Changes:
  • 5.2 - Added store, authenticate arguments
Errors: Changes:
  • 5.2 - Removed Macro_Error_Request error
Remote Example:
mymacros.json
Local Example:

msi

Runs an MSI installer. Version: 5.1 Supported OS:
  • Windows (not supported on UWP)
Arguments: Errors: Example:

notification

Sends a NotificationCenter event. This task is useful for one-way communication between the workflow engine and the javascript or interop. For two-way communication consider a javascript or interop workflow task. Version: 5.2 Arguments: Example: workflow.yaml:
main.js:

numberCompare

Compare two numbers. Version: 5.1 Arguments: Example:

pkg

Runs a PKG installer. This task inherits the arguments of the launch task. Version: 5.1 Supported OS:
  • macOS
Arguments: Example:

plistRead

Reads values from a property list file. Version: 5.1 Arguments: Additional Notes:
  1. key /value or keys arguments are required (not both)
Status Variables: Errors: Example:

plistWrite

Adds or edits values in a property list file. Version: 5.1 Arguments: Additional Notes:
  1. key /value or keyValuePairs arguments are required (not both)
Errors: Example:

preferencesDelete

Delete a preferences key. Version: 8.0.52 Supported OS:
  • macOS
Arguments: Errors: Example:

preferencesExists

Check if a preferences key exists. Version: 8.0.52 Supported OS:
  • macOS
Arguments: Example:

preferencesRead

Reads a preference. Version: 8.0.52 Supported OS:
  • macOS
Arguments: Additional Notes:
  1. key /value or keys arguments are required (not both)
Status Variables: Example:

preferencesWrite

Adds or edits preferences. Version: 8.0.52 Supported OS:
  • macOS
Arguments: Additional Notes:
  1. key /value or keyValuePairs arguments are required (not both)
  2. If the preferences location does not exist, it will be created
  3. If the preferences key already exists, it will be overwritten
Errors: Example:

processIsOpen

Checks to see if a program is running. Version: 5.2 (previously known as “programIsOpen” in 5.1) Supported OS:
  • Windows (not supported on UWP)
  • macOS
Arguments: Status Variables: Additional Notes:
  1. path or id arguments are required (not both)
Changes:
  • 6.1 - Added id argument to search for process by id
Example:

processList

Enumerates processes. Version: 5.2 Arguments: Status Variables: Changes:
  • 6.1 - Added path argument.
Example: Enumerate all children:
Enumerate all children of a certain process recursively:

processOpen

Opens an executable, a file, or a url using the default editor. This task automatically downgrades the elevation rights to “User”. Version: 5.2 (previously known as “open” or “programOpen”) Supported OS:
  • Windows (not supported on UWP)
  • macOS
Arguments: Status Variables: Errors: Changes:
  • 5.2 - Added path status variable.
  • 7.1.45 - Added arguments.
  • 8.0.76 - Added environmentVariables.
  • 8.1.14 - Added displayErrors and allowMultipleInstances for macOS.
Example:

processClose

Closes a program based on its process id. Terminates after attempting to close a program gracefully. Version: 5.2 (previously known as “programClose” in 5.1) Supported OS:
  • Windows (not supported on UWP)
  • macOS
  • Linux
Arguments: Changes:
  • 6.1 - Added waitForClose argument
Example:

progress

Unified progress for multiple tasks. See the unified progress bar documentation. Version: 5.1

queue

Queue of workflow tasks to run. Version: 5.1 Arguments: Status Variables: Additional Notes:
  1. When an action fails, no further actions are run.
Changes:
  • 5.2 - Added totalActions, runningActions, completeActions, currentAction status variables
  • 6.1 - Removed concurrentTasks, runningActions
Example:

registryKeyCreate

Create a registry key. Version: 5.1 Supported OS:
  • Windows (not supported on UWP)
Arguments: Errors: Changes:
  • 7.0 - Remove support for macOS
Example:

registryKeyDelete

Delete a registry key or registry value. Version: 5.1 Supported OS:
  • Windows (not supported on UWP)
Arguments: Errors: Changes:
  • 6.1 - Support multiple views
  • 7.0 - Remove support for macOS
  • 7.1 - Added value argument
Example:

registryKeyExists

Check if a registry key exists. Version: 5.1 Supported OS:
  • Windows (not supported on UWP)
Arguments: Changes:
  • 6.1 - Support multiple views
  • 7.0 - Remove support for macOS
Example:

registryKeyRead

Reads registry keys. Version: 5.1 Supported OS:
  • Windows (not supported on UWP)
Arguments: Additional Notes:
  1. key /value or keys arguments are required (not both)
Changes:
  • 6.1 - Support multiple views
  • 7.0 - Remove support for macOS
Status Variables: Example:

registryKeyWrite

Adds or edits registry keys. Version: 5.1 Supported OS:
  • Windows (not supported on UWP)
Arguments: Additional Notes:
  1. key /value or keyValuePairs arguments are required (not both)
  2. If the registry location does not exist, it will be created
  3. If the registry key already exists, it will be overwritten
Errors: Changes:
  • 6.1 - Added onlyIfExists argument
  • 7.0 - Remove support for macOS
Example:

repository*

The following arguments are shared among the repositorySync/repositoryCheck/repositoryErase tasks. Arguments: Additional Notes:
  1. Setting cleanup to false also disables file deletion during patch application
Changes:
  • 7.2 - Added authenticate argument to all repository tasks

Phases container

Configure progress status/weighting based on the current phase of a download Phase Container Example:

Storage container

In the workflow, storage containers are local , backup , pending and remote . Status Variables: It’s recommend to rely only on the top level items, items in the sub levels are for internal usage and debugging.

repositoryCheck

Checks to see if an existing repository needs to be updated. Version: 5.1 Arguments: See Repository Configuration documentation for additional information. Changes:
  • 5.2 - Added store argument
Example:

repositoryErase

Erase an existing repository. Version: 5.1 Arguments: See Repository Configuration documentation for additional information. Example:

repositoryFileCheck

Checks to see if an existing repository needs to be repaired by examining the existance, size, and modified timestamp of the files on disk. Version: 5.1.9 Arguments: Errors: Example:

repositorySync

Updates an existing repository. Version: 5.1 Arguments: See Repository Configuration documentation for additional information. Additional Notes:
  1. Tasks with repair enabled will ignore the source and mask fields if returned by the catalog file, so that whole pieces are used to repair the filesystem and no pieces are skipped.
Changes:
  • 5.2 - Added store argument
Example:

restorePoint

Sets a restore point. Version: 5.1.8 (previously known as “restorePointBegin”) Supported OS:
  • Windows (elevation required, not supported on UWP)
Arguments: Notes:
  1. Starts the restore point before the actions are executed. If any of the actions fails, the restore point is cancelled. If all the actions succeed, then the restore point ends.
Errors: Example:

shortcutCreate

Creates a shortcut. Version: 5.1 Supported OS:
  • Windows (not supported on UWP)
  • Linux
Arguments: Errors: Example:

shortcutDelete

Deletes a shortcut. Version: 5.1 Supported OS:
  • Windows (not supported on UWP)
  • Linux
Arguments: Errors: Example:

shutdown

Stops further tasks from being run. Version: 5.1 Arguments: Example:

singleton

Prevents launching concurrent tasks across multiple workflows. Version: 6.1 Supported OS:
  • Windows (not supported on UWP)
  • macOS
  • Linux
Arguments: Example:

skinFileExtract

Extracts a file from the skin to disk. Version: 6.1 Supported:
  • Only available in the DirectGVR Client (host).
Arguments: Example:

sleep

Waits for a specified amount of time. Version: 5.1 Arguments: Example:

status

Updates the status for a specific object in the workflow. Version: 5.1 Arguments: Example:

stringCompare

Compare two strings. Version: 5.1 Arguments: Example:

stringContains

Check if one string contains another. Version: 5.1 Arguments: Example:

unzip

Extracts a zip archive to disk. Version: 5.1 Arguments: Status Variables: Changes:
  • 5.2 - Added password argument for encrypted archives
  • 5.2 - Added support for AES encrypted archives
Example:

urlRedirect

DEPRECATED: This task can cause a naming conflict if the beginsWith parameter matches another beginsWith parameter in this or a separate workflow. Redirection should be configured in the webget section of the host configuration. Redirects one URL to another. Version: 5.1 Arguments: Additional Notes:
  1. beginsWith /append or beginsWith /replace arguments are required (not all).
Example:

urlRedirectMacro

DEPRECATED: This task can cause a naming conflict if the key parameter matches another key parameter in this or a separate workflow. Macros should be configured in the webget section of the host configuration. Adds a custom macro to the URL redirection subsystem to be used by the urlRedirect task. Version: 5.1.8 Arguments: Additional Notes:
  1. key/value orkeyValuePairs arguments are required (not all)
Example:

versionCompare

Compares two version numbers. A version number contains up to 4 numbers separated by periods or commas representing major, minor, release and build numbers. A version number string an optionally begin with the letter v. Example of a switch key usage: application.exe /action uninstall /key value Version: 5.1 Arguments: Example:

wmi

Queries the Windows Management Instrumentation service. Version: 5.1.3 Supported OS:
  • Windows (not supported on UWP)
Arguments: Additional Notes:
  1. key or keys arguments are required (not both)
Errors: Example:

workflowRun

Runs a separate workflow.1 Version: 5.1 Arguments: Additional Notes:
  1. This task is not supported in the self-update workflow apply entry point.
  2. To ensure that macros are passed from an unelevated to an elevated workflow properly, the load entry point task must be a macro task. Otherwise, any macros passed from an unelevated to an elevated workflow may be overwritten by tasks further down the load entry point task chain in the elevated process.
Changes:
  • 5.2 - Added store argument
Status Variables: Errors: Example:
Example using another task in the same workflow:

xmlRead

Reads values from an xml file. Version: 5.1 Arguments: Additional Notes:
  1. path or url arguments are required (not both)
  2. key /value or keys arguments are required (not both)
Status Variables: Errors: Changes:
  • 5.2 - Added url argument
  • 5.2 - Added Xml_Error_Parse error
Example: Xml:
Workflow:

xmlWrite

Adds or edits values in a xml file. Version: 5.1 Arguments: Additional Notes:
  1. key /value or keyValuePairs arguments are required (not both)
Errors: Example: Xml:
Workflow: