> ## Documentation Index
> Fetch the complete documentation index at: https://docs.directgvr.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Tasks

> Reference for every task type in the DirectGVR workflow engine.

## 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.

| **YAML** | **JSON** |
| - | - |
| `taskOne: type: log message: hello world taskTwo: type: log message: good bye world` | `{ "taskOne": { "type": "log", "message": "hello world" }, "taskTwo": { "type": "log", "message": "good bye world" } }` |

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* .

```json theme={null}
start:
  type: log
  message: getting started
  success: end
end:
  type: log
  message: finishing
```

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.

| **Name** | **Description** |
| - | - |
| apply | Task to run when the self-update is applied when process is restarted. |
| load | Task to run when the workflow is loaded. This entry point is run internally. |
| launch | Task to run when the button is clicked. |
| repair | Task to run when the repair button is clicked. |
| start | Task to run when the workflow is started, after *load* is completed. |
| state | Task to run on an interval, after *start* is completed. Can be used to check to see if patches are up to date every so often. Return values: *Application\_NotInstalled* error if the application is not installed. *Application\_UpdateRequired* error if the application requires an update. No error if the application is installed and up-to-date. |
| uninstall | Task to run when the uninstall button is clicked. |
| unload | Task to run when the workflow is unloaded. This entry point frees the workflow and should be the last to run. |
| update | Task to run when the update button is clicked. |

**Other Reserved Names**

| **Name** | |
| - | - |
| status | Reserved due to conflicts with argument expansion. |
| args | Reserved due to conflicts with argument expansion. |

### 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.

```json theme={null}
abCompare:
  type: stringCompare
  stringOne: a
  stringTwo: b
  equalTo: cdCompare
cdCompare:
  type: stringCompare
  stringOne: c
  stringTwo: d
  equalTo: efCompare
```

**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.

```json theme={null}
oneTwoCompare:
  type: numberCompare
  numberOne: 1
  numberTwo: 2
  notEqual: numbersEqual-{systemShortName}?
```

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.

```json theme={null}
include:
  - workflow-install.yaml
  - workflow-uninstall.yaml
  - workflow-.yaml
```

## 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.

| **Name** | **Type** | **Description** |
| - | - | - |
| \{workflowPath} | string | Path to the workflow file, if loaded from the filesystem. |
| \{workflowDirectory} | string | Directory of the workflow file, if loaded from the filesystem. |
| \{workflowURL} | string | URL of the workflow, if loaded from a runWorkflow task. |

### 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.

| **Name** | **Description** |
| - | - |
| this | Current task object. |
| parent | Current object's parent. |
| parent:`TN` | Find the parent object with the specified task name (`TN`). |
| args | Task's arguments. |
| status | Task or workflow's status variables. |

**Examples**

| **Expandable String** | **Description** |
| - | - |
| \{this.args.applicationName} | Gets the applicationName argument for the current task. |
| \{this.parent.args.applicationName} | Gets the applicationName argument from the current task's parent. |
| \{this.parent.parent.args.type} | Gets the type argument from the current task's gradparent. |
| \{this.parent.status.downloadSpeed} | Gets the downloadSpeed status property for the current task's parent. |
| \{workflow\.status.startTime} | Get's the current workflow's startTime status property. |

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.

```json theme={null}
download:
  type: download
  outputPath: "{temp}"
  url: https://myurl/myfilename.exe
  success: launch
launch:
  type: launch
  path: "{this.parent.status.outputPath}"
  successCode: 0
  waitForExit: true
```

## Tasks

*Required arguments are bold in the arguments list.*

All tasks can have the following reserved arguments:

| **Name** | **Type** | **Description** |
| - | - | - |
| type | string | Type of task. |
| title | string | Title to show when the task is first started. |
| status | key/value pairs, string array, or string | Status to show when task is first started. If *array of strings* , then first string is *start* status, the second string is *success* status, and the third string is the *failure status* . If *key/value pairs* , then the corresponding status is set for the keys: *start* , *success* , *failure* , *complete* . |
| ignoreError | boolean/array | Ignore error conditions for this task. If *array of strings* , then it ignores only those errors specified in the array. |
| verbose | boolean | Print out verbose debug information to log. |
| success | string | Task to run when the current task finishes without an error. |
| failure | string | Task to run when the current task finishes with an error. |
| complete | string | Task to run when the current task has finished without being cancelled. |

### 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:

| **Name** | **Description** |
| - | - |
| Task\_Error\_MissingSubTask | Failed to find subtask. |
| Task\_Error\_MissingArg | Failed due to missing argument. |
| Task\_Error\_InvalidArg | Failed due to invalid argument. |
| Task\_Error\_Cancelled | Failed due to cancellation. |

#### Platform errors

The following error codes are used throughout the workflow engine.

| **Name** | **Description** |
| - | - |
| Platform\_Error\_None | No error. |
| Platform\_Error\_AccessInvalid | Invalid access to perform operation. |
| Platform\_Error\_AccessDenied | Denied access to perform operation. |
| Platform\_Error\_Locked | Cannot perform operation due to lock. |
| Platform\_Error\_Missing | Required resource was not found. |
| Platform\_Error\_NotEnoughSpace | Not enough space to perform operation. |
| Platform\_Error\_Unknown | Unknown error. |

### 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.

```json theme={null}
download:
  type: download
  outputPath: "{temp}"
  .url: https://myurl/myfilename.exe
  success: launch
```

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:**

| **Name** | **Type** | **Description** | **Default** |
| - | - | - | - |
| **url** 1 | string | URL with JSON object to aggregate. Can contain a list of tasks and their arguments to merge Can be used in conjunction with the *target* argument to specify the task to merge with. | |
| **content** 1 | object/string | Object or JSON string of object to aggregate. Maximum length as a string is 16384 characters. | |
| source2 | string | Used to specify the path to merge from with-in the JSON object specified at the *url* . | |
| target2 | string | Used to specify the task to merge with if the JSON object specified at the *url* contains a dictionary of arguments. It is possible to also specify the path inside the task to merge at (for example mytask.config). | |
| store | string/array | Certificate store used to authenticate (default: "app") Predefined certificate stores: app: Application certificate store platform: System certificate store null: Empty certificate store If this value is defined, it forces authenticate to true and requires content to be signed regardless of the protocol used to deliver it. | |
| progress | boolean | Report current/total progress in status notifications. | |
| authenticate | boolean | Authenticates the signature in JSON content. By default, it will authenticate the JSON on an HTTP connection and will not authenticate the JSON on a HTTPS connection because it is already secure. It will not try to authenticate a connection to the local \{contentUrl} webserver. | true |

**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:**

| **Name** | **Description** |
| - | - |
| Aggregate\_Error\_Parse | Failed to parse remote content. |
| Aggregate\_Error\_Authenticate | Failed to authenticate JSON. |
| Aggregate\_Error\_Merge | Failed to merge object. |
| WebGet\_Error\_\* | WebGet errors. |
| Platform\_Error\_\* | Platform errors. |

**Changes:**

* 5.2 - Removed Aggregate\_Error\_Request error

**Example 1 - Using Multiple Targets**

workflow\.yaml:

```json theme={null}
start:
  type: aggregate
  url: https://../items.yaml
logSomethingOne:
  type: log
logSomethingTwo:
  type: log
```

items.yaml:

```json theme={null}
logSomethingOne:
  message: something One
logSomethingTwo:
  message: something Two
```

**Example 2 - Using Content**

workflow\.yaml:

```json theme={null}
start:
  type: aggregate
  content:
    logSomething:
      - message: something One
      - message: something Two
      - message: something Three
logSomething:
  type: log
```

It is also possible to use a dictionary instead of a list the *logSomething*  inside c*ontent*  if you are only aggregating a single task:

**Example 3 - Using Target**

workflow\.yaml:

```json theme={null}
start:
  type: aggregate
  target: logSomething
  url: "{contentUrl}items.yaml"
logSomething:
  type: log
```

items.yaml:

```json theme={null}
message: something One
```

**Example 4 - Using Target and Source**

workflow\.yaml:

```json theme={null}
start:
  type: aggregate
  source: path1.path2
  target: logSomething
  url: "{contentUrl}items.yaml"
logSomething:
  type: log
```

items.yaml:

```json theme={null}
path1:
  path2:
    message: something One
```

**Example 5 - Using Target with JSON**

workflow\.yaml:

```json theme={null}
start:
  type: aggregate
  target: logSomething
  url: "{contentUrl}items.json"
logSomething:
  type: log
```

items.json:

```json theme={null}
[{
  "message": "something One",
},
{
  "message": "something Two",
}]
```

### analytics

Add additional analytics properties to send for every event.

**Version:**  5.1.9

**Arguments:**

| **Name** | **Type** | **Description** | **Default** |
| - | - | - | - |
| global | boolean | If *true* , analytics properties will be extended app-wide, otherwise if *false* , analytics properties will be extended workflow-wide. | false |
| **key** 1 | string | Property name. | |
| **value** 1 | string/integer | Property value. | |
| **keyValuePairs** 1 | object | Property key/value pairs. | |

**Additional Notes:**

1. *url*  or *key/value* or*keyValuePairs* arguments are required (not all)

**Changes:**

* 5.2 - Added global argument

**Example:**

```json theme={null}
extendAnalytics:
  type: analytics
  keyValuePairs:
    os: "{systemName} {systemVersion} ({systemBitness}-bit)"
    appVersion: "{appVersion}"
```

Alternatively, each task supports an *analytics*  section which are additional properties to send for that task event.

```json theme={null}
myEvent:
  type: myTask
  prop1: strval1
  analytics:
    os: "{systemName} {systemVersion} ({systemBitness}-bit)"
    appVersion: "{appVersion}" 
```

### certStoreLoad

Load a certificate store valid for this workflow only.

**Version:**  5.2

**Arguments:**

| **Name** | **Type** | **Description** | **Default** |
| - | - | - | - |
| **url** | string | URL/file of the thumbprint list/jwks file. Should always be an https URL for a secure environment. | |
| name | string | Name of the certificate store | |

**Errors:**

| **Name** | **Description** |
| - | - |
| Json\_Error\_Authenticate | Failed to authenticate url content |
| Json\_Error\_Parse | Failed to parse url content |
| CertStore\_Error\_Load | Failed to load certificate store |

**JWKS Documentation**

Documentation of the file format can be found at [https://auth0.com/docs/jwks](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)

```json theme={null}
{
    "cdn.example.com": "teOGxFJgJJdpfxwD/soVGBQ6YX4=",
    "ssn": "teOGxFJgJJdpfxwD/soVGBQ6YX4=",
    "example": "iP8N+8Z4KJNZ8+5nm8J7efYruuU=",
    "ssntesting256mac": "+zHAcP1dSgIIn9Zdm3bPz2iIcyM="
}
```

**Example:**

```json theme={null}
trustJWKS:
  type: certStoreLoad
  name: hello
  url: https://localhost/hello.jwks.json
```

### directoryCopy

Copies the contents of a directory from one location to another.

**Version:**  5.1.8

**Arguments:**

| **Name** | **Type** | **Description** | **Default** |
| - | - | - | - |
| **sourcePath** | string | Path of directory with contents to copy. | |
| **targetPath** | string | Path to copy contents to. | |
| overwrite | boolean | Overwrite existing files. | true |
| recurse | boolean | Copy recursively. | true |

**Changes:**

* 5.2 - Added overwrite argument

**Example:**

```json theme={null}
copyFolder:
  type: directoryCopy
  sourcePath: "{pathJoin:{moduleDirectory},example}"
  targetPath: "{pathJoin:{moduleDirectory},example2}"
  recurse: true
```

### directoryCreate

Creates a directory on the file system.

**Version:**  5.1

**Arguments:**

| **Name** | **Type** | **Description** |
| - | - | - |
| **path** | string | Path of directory to create. |

**Example:**

```json theme={null}
createExample:
  type: directoryCreate
  path: "{pathJoin:{moduleDirectory},example}"
```

### directoryMove

Moves the contents of a directory from one location to another.

**Version:**  5.1.8

**Arguments:**

| **Name** | **Type** | **Description** |
| - | - | - |
| **sourcePath** | string | Path of directory with contents to move. |
| **targetPath** | string | Path to move contents to. |

**Example:**

```json theme={null}
moveFolder:
  type: directoryMove
  sourcePath: "{pathJoin:{moduleDirectory},example}"
  targetPath: "{pathJoin:{moduleDirectory},example2}"
```

### directoryDelete

Delete a directory from the file system recursively. If the specified directory does not exist, the task will succeed.

**Version:**  5.1

**Arguments:**

| **Name** | **Type** | **Description** | **Default** |
| - | - | - | - |
| **path** | string | Path of directory to erase. | |
| failIfMissing | boolean | Reports an error when the directory does not exist. | false |
| onlyIfEmpty | boolean | Only delete the directory if it is empty. Ignores shell browsing metadata files like .DS\_Store, thumbs.db, and desktop.ini. | false |

**Example:**

```json theme={null}
deleteExample:
  type: directoryDelete
  path: "{pathJoin:{moduleDirectory},example}"
```

### directoryList

Enumerates a directory.

**Version:**  5.2

**Arguments:**

| **Name** | **Type** | **Description** | **Default** |
| - | - | - | - |
| **path** | string | Search path and wildcard pattern. To search all files in a directory, the path should end with a slash. | |
| skipHidden | boolean | Skip hidden files and directories. | true |
| skipReadOnly | boolean | Skip read only files and directories. | false |
| forEachFile | string | Task to run when a file is found. | |
| forEachDirectory | string | Task to run when a directory is found. | |

**Status Variables:**

| **Name** | **Type** | **Description** |
| - | - | - |
| directory | string | Search directory |
| path | string | Full path to the file or directory found. |
| name | string | Name of the entry |
| modifiedTime | integer | Modified time of entry |
| creationTime | integer | Creation time of entry |
| size | integer | Size of entry |
| hidden | integer | 1 if hidden, 0 otherwise |
| readOnly | integer | 1 if read only, 0 otherwise. |

**Example:**

```json theme={null}
logFile:
  type: log
  message: file {this.parent.status.path} - mtime {this.parent.status.modifiedTime} - 
    ctime {this.parent.status.creationTime} - size {this.parent.status.size}
logDirectory:
  type: log
  message: directory - {this.parent.status.path} - mtime {this.parent.status.modifiedTime} - 
    ctime {this.parent.status.creationTime} - size {this.parent.status.size}
start:
  type: directoryList
  path: "{systemDrive}"
  forEachFile: logFile
  forEachDirectory: logDirectory
```

**Recursive Example:**

```json theme={null}
printFiles:
  type: log
  message: file - {this.parent.status.path} - mtime {this.parent.status.modifiedTime} 
    ctime - {this.parent.status.creationTime} size - {this.parent.status.size}
printDirectories:
  type: log
  message: directory - {this.parent.status.path} - mtime {this.parent.status.modifiedTime} 
    ctime - {this.parent.status.creationTime} size - {this.parent.status.size}
  path: "{this.parent.status.path}"
  success: listNextDirectory
listNextDirectory:
  type: directoryList
  path: "{this.parent.parent.status.path}"
  forEachFile: printFiles
  forEachDirectory: printDirectories
listSystemDrive:
  type: directoryList
  path: "{systemDrive}"
  forEachFile: printFiles
  forEachDirectory: printDirectories
start:
  type: queue
  actions:
    - listSystemDrive
```

### directoryExists

Check if a directory exists on the file system.

**Version:**  5.1

**Arguments:**

| **Name** | **Type** | **Description** |
| - | - | - |
| **path** | string | Path of directory to check. |
| exists | string | Task to run if the directory exists. |
| missing | string | Task to run if the directory is missing. |

**Example:**

```json theme={null}
checkDir:
  type: directoryExists
  path: "{pathJoin:{moduleDirectory},example}"
  exists: updateExample
```

### 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:**

| **Name** | **Type** | **Description** | **Default** |
| - | - | - | - |
| **path** | string | Path of directory to check. | |
| failIfMissing | boolean | Reports an error when the directory does not exist. | false |
| empty | string | Task to run if the directory is empty. | |
| notEmpty | string | Task to run if the directory is not empty. | |

**Example:**

```json theme={null}
checkDirIsEmpty:
  type: directoryIsEmpty
  path: "{pathJoin:{moduleDirectory},example}"
  empty: deleteDir
```

### 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:**

| **Name** | **Type** | **Description** | **Default** |
| - | - | - | - |
| **path** | array/string | Path of one or more directories to check. | |
| recurse | boolean | If directory does not exist\*,\* find the nearest parent directory that exists and verifies it has write permissions on it. | false |
| writable | string | Task to run if the directory is writable. | |
| notWritable | string | Task to run if the directory is not writable. | |

**Example:**

```json theme={null}
checkDirIsWritable:
  type: directoryIsWritable
  path: "{pathJoin:{moduleDirectory},example}"
  writable: installFiles
  notWritable: installFilesElevated
```

### diskSpaceCheck

Checks the disk space on a certain path.

**Version:**  5.1

**Arguments:**

| **Name** | **Type** | **Description** |
| - | - | - |
| **requiredBytes** | int | Number of bytes required to successfully complete the task. |
| path | string | Path of the file system to check for free space. |
| enough | string | Task to run when there is enough space on the disk. |
| notEnough | string | Task to run when there is not enough space on the disk. |

**Example:**

```json theme={null}
checkDiskSpaceOnCDrive:
  type: diskSpaceCheck
  path: c:\
  requiredBytes: 129199967040
  enough: installApp
  notEnough: notifyUser
```

### dmgMount

Mounts an apple disk image.

**Version:**  5.1

**Supported OS:**

* macOS

**Arguments:**

| **Name** | **Type** | **Description** |
| - | - | - |
| **path** | string | Path to the .dmg file to mount. |
| target | string | Name to mount to in /Volumes/. Specifying *MyProduct* would mount to /Volumes/MyProduct. When no target is specified, the dmg is mounted to /Volumes/\{sha1:path}/. |

**Errors:**

| **Name** | **Description** |
| - | - |
| DiskImage\_Error\_Launch | Failed to launch disk image utility. |
| DiskImage\_Error\_Mount | Failed to mount disk image. |

**Example:**

```json theme={null}
mountMyProductDmg:
  type: dmgMount
  path: "{pathJoin:{this.parent.status.OutputDirectory},product.dmg}"
```

### dmgUnmount

Unmounts an apple disk image.

**Version:**  5.1

**Supported OS:**

* macOS

**Arguments:**

| **Name** | **Type** | **Description** |
| - | - | - |
| **path** | string | Path to the .dmg file to unmount. |
| target | string | Name mounted to in /Volumes/. Specifying *MyProduct* would unmount /Volumes/MyProduct. When no target is specified, the dmg unmounted is /Volumes/\{sha1:path}/. |

**Errors:**

| **Name** | **Description** |
| - | - |
| DiskImage\_Error\_Launch | Failed to launch disk image utility. |
| DiskImage\_Error\_Mount | Failed to mount disk image. |

**Example:**

```json theme={null}
unmountMyProductDmg:
  type: dmgUnmount
  path: "{pathJoin:{this.parent.status.OutputDirectory},product.dmg}"
```

### download

Downloads a file to disk.

**Version:**  5.1.2

**Arguments:**

| **Name** | **Type** | **Description** | **Default** |
| - | - | - | - |
| **url** | string | URL to download. | |
| outputPath | string | Path of the file on disk to save to. If the path is a directory, it will output to that directory using the filename from the URL. If no filename is specified in the URL and the path is a directory, an error will be returned from the task. | |
| headers | key/value pairs | Additional request headers to send. | |
| cookies | key/value pairs | Cookies to send with the request. | |
| timeout | number | Number of seconds to wait for a socket *read* before timing out. This is not a socket *connect* timeout. | 15 |
| maxRetries | number | Number of times to retry after the first error. After a failed attempt, there is a delay before the next attempt. The delay doubles each attempt until it reaches the max delay of 3840 seconds (15, 30, 60, 120, 240, 480, 960, 1920, 3840). | 3 |
| allowProxy | boolean | Allow connections through a proxy. | true |
| allowResume | boolean | Allow the output file to resume downloading, otherwise always overwrite the output file. | false |
| allowGzip | boolean | Allow the content to be returned from the server gzip compressed. | true |
| allowHeadRequest | boolean | Use a HEAD request to determine the size of the content prior to downloading, otherwise use a GET request. | true |
| skipTimestamp | boolean | Skip syncing the timestamp from the server to the files downloaded on disk. The file on disk will have the modified date of the time they were created, otherwise it will have the modified date as specified by the remote server. | false |
| overwriteIfNewer | boolean | Overwrite the local file with the remote file if the remote file is newer than the local file. Requires allowResume to be *true* and *skipTimestamp* to be *false* . | false |
| overwriteIfOlder | boolean | Overwrite the local file with the remote file if the remote file is older than the local file. Requires allowResume to be *true* and*skipTimestamp* to be *false* . | false |
| limitBodySize | number | Specifies the maximum number of bytes that can be downloaded in the response body. | |

**Status Variables:**

| **Name** | **Type** | **Description** |
| - | - | - |
| name | string | Filename of URL |
| paused | boolean | Whether or not the download is paused. |
| active | boolean | Whether or not the download is downloading. |
| skipped | boolean | Whether or not the download was skipped. |
| supportResume | boolean | Whether or not the download supports resume. |
| supportPause | boolean | Whether or not the download supports pause. |
| supportSkip | boolean | Whether or not the download supports skipping. |
| canPauseResume | boolean | Whether or not download can pause or resume |
| completeBytes | number | Number of bytes completed. |
| totalBytes | number | Number of bytes total in download. |
| existingBytes | number | Number of bytes already downloaded. |
| remainingTime | number | Number of seconds remaining for download. |
| remainingBytes | number | Number of bytes remaining to download. |
| localReadBytes | number | Number of bytes read from the file. Always 0. |
| remoteReadBytes | number | Number of bytes downloaded. |
| localWriteBytes | number | Number of bytes saved to the file. |
| remoteWriteBytes | number | Number of bytes uploaded. |
| localReadSpeed | number | Number of bytes read from the file per second. Always 0. |
| remoteReadSpeed | number | Number of bytes downloaded per second. |
| localWriteSpeed | number | Number of bytes saved to the file per second. |
| remoteWriteSpeed | number | Number of bytes uploaded per second. |
| remoteAvgReadSpeed | number | Average number of bytes downloaded per second. |
| remoteAvgWriteSpeed | number | Average number of bytes uploaded per second. |
| localMaxReadSpeed | number | Maximum number of bytes read from the file per second. Always 0. |
| remoteMaxReadSpeed | number | Maximum number of bytes downloaded per second. |
| localMaxWriteSpeed | number | Maximum number of bytes saved to the file per second. |
| remoteMaxWriteSpeed | number | Maximum number of bytes uploaded per second. |
| activeTime | number | Seconds download was active. |
| pauseTime | number | Seconds download was paused. |
| outputPath | string | Output file's full path. |
| outputFilename | string | Output file's name. |
| outputDirectory | string | Output file's directory. |
| responseCode | number | HTTP response status code |
| responseVersion | string | HTTP response status version |
| responseMessage | string | HTTP response status message |
| responseHeaders | object | HTTP response headers. (Not sent to analytics) |

**Errors:**

| **Name** | **Description** |
| - | - |
| WebGet\_Error\_\* | WebGet errors. |
| Platform\_Error\_\* | Platform 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:**

```json theme={null}
downloadUbuntu:
  type: download
  url: http://releases.ubuntu.com/16.04.1/ubuntu-16.04.1-desktop-amd64.iso
  outputPath: "{pathJoin:{userDesktop},ubuntu-16.04.1-desktop-amd64.iso}"
  headers:
    test11: value2
    test22: "{moduleDirectory}"
```

### environmentGet

Gets an environment variable for the current process.

**Version:**  6.1

**Arguments:**

| **Name** | **Type** | **Description** |
| - | - | - |
| **key** | string | Name of the environment variable to get. |

**Example:**

```json theme={null}
getEnv:
  type: environmentGet
  key: username
  complete: printEnv
printEnv:
  type: log
  message: "{this.parent.status.username}"
```

### environmentSet

Sets an environment variable for the current process.

**Version:**  6.1

**Arguments:**

| **Name** | **Type** | **Description** |
| - | - | - |
| **key** 1 | string | Name of the environment variable to set. |
| **value** 1 | string | Value to set. Maximum length is 4096. |
| **keyValuePairs** 1 | object | Block of key/value pairs to set. |

**Additional Notes:**

1. *key* /*value*  or *keyValuePairs*  arguments are required (not both)

**Example:**

```json theme={null}
setEnv:
  type: environmentSet
  key: username
  value: xyz
  complete: launchNotepad
```

### error

Sets an error for the current task chain. Alternatively sets the exit code without shutting down.

**Version:**  5.1

**Arguments:**

| **Name** | **Type** | **Description** |
| - | - | - |
| exitCode | integer | Exit code to return from the program. |
| message | string | Error message to assign to task. |
| break | boolean | Break into system debugger. |

**Example:**

```json theme={null}
caseOk:
  type: error
  exitCode: 72
caseNotOk:
  type: error
  message: Task_Error_Apocalypse
  exitCode: 666
```

### fileAuthenticate

Authenticates the signature of a file on disk.

**Version:**  5.1.3

**Arguments:**

| **Name** | **Type** | **Description** |
| - | - | - |
| **path** | string | Path of file to authenticate. Windows To pass authentication, must be a valid code-signed PE formatted binary. macOS To pass authentication, must be a valid code-signed MachO binary or pkg installer. Linux: To pass authentication, must be an ELF binary; Linux has no code-signing. |
| store | string/array | Certificate store used to authenticate (default: "app") Predefined certificate stores: app: Application certificate store platform: System certificate store null: Empty certificate store |
| valid | string | Task to run when file passes authentication. |
| notValid | string | Task to run when file does not pass authentication. |

**Changes:**

* 5.2 - Added store argument

**Example:**

```json theme={null}
checkSignature:
  type: fileAuthenticate
  path: "{pathJoin:{moduleDirectory},app.exe}"
  valid: fileIsOkToRun
  notValid: fileIsNotOkToRun
```

### fileCopy

Copies files from one location to another on disk.

**Version:**  5.1

**Arguments:**

| **Name** | **Type** | **Description** |
| - | - | - |
| **sourcePath** | string | Source file to copy. |
| **targetPath** | string | Target file to copy to. |
| readOnly | boolean | If explicitly set, it will ensure the target file has the read-only flag set or not. If not explicitly set, it will copy the read-only flag of the source file. |

**Changes:**

* 6.1 - Added *readOnly*  argument

**Example:**

```json theme={null}
copyFilesToDesktop:
  type: fileCopy
  sourcePath: "{pathJoin:{moduleDirectory},source.exe}"
  targetPath: "{pathJoin:{userDesktop},target.exe}"
```

### fileDelete

Deletes a file from the file system. If the specified file does not exists, the task will succeed.

**Version:**  5.1

**Arguments:**

| **Name** | **Type** | **Description** | **Default** |
| - | - | - | - |
| **path** | string | Path of file to be erased. | |
| waitForReboot | boolean | Wait for reboot to erase. Requires elevation. | false |
| failIfMissing | boolean | Reports an error when the file does not exist. | false |

**Example:**

```json theme={null}
deleteExample:
  type: fileDelete
  path: "{pathJoin:{moduleDirectory},example,example.file}"
```

### fileExists

Check if a file exists on the file system.

**Version:**  5.1

**Arguments:**

| **Name** | **Type** | **Description** |
| - | - | - |
| **path** | string | Path of file to check. |
| exists | string | Task to run if the file exists. |
| missing | string | Task to run if the file is missing. |

**Example:**

```json theme={null}
checkExample:
  type: fileExists
  path: "{pathJoin:{moduleDirectory},example,test.txt}"
  missing: downloadExample
```

### fileHash

Gets or compares the hash of a file on disk.

**Version:**  5.1.3

**Arguments:**

| **Name** | **Type** | **Description** | **Default** |
| - | - | - | - |
| **path** | string | Path of file to hash. | |
| algorithm | string | Name of the hash interface: crc md5 sha1, sha224, sha256, sha384, sha512 | sha1 |
| expectedDigest | string | Expected hash digest. | |
| equalTo | string | Task to run if the actual hash equals the expected hash. | |
| notEqualTo | string | Task to run if the actual has does not equal the expected hash. | |

**Additional Notes:**

* If *expectedDigest*  is an empty string, the task will complete successfully without *equalTo*  or *notEqual*  sub-actions being called\*\*.\*\*

**Status Variables:**

| **Name** | **Type** | **Description** |
| - | - | - |
| actualDigest | string | Actual digest of the file on disk. |
| expectedDigest | string | Digest that was expected. |

**Changes:**

* 7.0 - Removed MD2 & MD4 hash algorithms.

**Example:**

```json theme={null}
checkFileHash:
  type: fileHash
  path: "{pathJoin:{moduleDirectory},app.exe}"
  algorithm: md5
  expectedDigest: 9569052415bfa09d411a0aaedf5acbd6
  equalTo: fileIsCorrect
  notEqualTo: fileIsCorrupt
getFileHash:
  type: fileHash
  path: "{pathJoin:{moduleDirectory},app.exe}"
  algorithm: md5
  complete: logFileHash
logFileHash:
  type: log
  message: "{this.parent.status.ExpectedDigest} vs {this.parent.status.ActualDigest}"
```

### fileMove

Moves a file from one location on disk to another.

**Version:**  5.1

**Arguments:**

| **Name** | **Type** | **Description** | **Default** |
| - | - | - | - |
| sourcePath | string | Source file path to move. | |
| targetPath | string | Target file path to move to. If the target directory does not exist, it will be created. | |
| failIfNotDeleted | boolean | Causes task to fail if the source is not deleted. | false |

**Example:**

```json theme={null}
moveFilesToDesktop:
  type: fileMove
  sourcePath: "{pathJoin:{moduleDirectory},source.exe}"
  targetPath: "{pathJoin:{userDesktop},target.exe}"
```

### jsonRead

Reads values from an json file.

**Version:**  5.1.8

**Arguments:**

| **Name** | **Type** | **Description** | **Default** |
| - | - | - | - |
| **path** 1 | string | Path to the json file. | |
| **url** 1 | string | URL to the json file. | |
| **content1** | object/string | Object or JSON string. | |
| **key** 2 | string | Key to read. | |
| **keys** 2 | array of strings | Keys to read. | |
| store | string/array | Certificate store used to authenticate (default: "app") Predefined certificate stores: app: Application certificate store platform: System certificate store null: Empty certificate store If this value is defined, it forces authenticate to true and requires content to be signed regardless of the protocol used to deliver it. | |
| authenticate | boolean | Authenticate the signature in JSON content. By default, it will authenticate the JSON on an HTTP connection and will not authenticate the JSON on a HTTPS connection because it is already secure. It will not try to authenticate a connection to the local \{contentUrl} webserver. | true |
| read | string | Task to run when all keys were read successfully. | |
| notRead | string | Task to run when one or more keys were not read. | |

**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:**

| **Name** | **Type** | **Description** |
| - | - | - |
| \* | string | Values that were read. |

**Errors:**

| **Name** | **Description** |
| - | - |
| Json\_Error\_Open | Failed to open json file |
| Json\_Error\_Parse | Failed to parse json content |
| WebGet\_Error\_\* | WebGet errors. |
| Platform\_Error\_\* | Platform errors. |

**Changes:**

* 5.2 - Added content argument
* 5.2 - Added url argument
* 5.2 - Added JSON\_Error\_Parse error

**Example:**

JSON:

```json theme={null}
{
    "catalog": {
        "bk101": {
            "author": "Gambardella, Matthew",
            "title": "XML Developer's Guide",
            "genre": "Computer",
            "price": 44.95,
            "publishDate": "2000-10-01",
            "description": "An in-depth look at creating applications with XML."
        }
    }
}
```

Workflow:

```json theme={null}
readValue:
  type: jsonRead
  path: "{pathJoin:{userDesktop},test.json}"
  key: catalog.bk101.author
  complete: logValue
logValue:
  type: log
  message: "{this.parent.status.author}"
```

### jsonWrite

Adds or edits values in a json file.

**Version:**  5.1.8

**Arguments:**

| **Name** | **Type** | **Description** |
| - | - | - |
| **path** | string | Path to the json file to write to. |
| **key** 1 | string | Key to write. |
| **value** 1 | string/integer | Value to write. |
| **keyValuePairs** 1 | key value pairs | Block of key/value pairs to write. |

**Additional Notes:**

1. *key* /*value*  or *keyValuePairs*  arguments are required (not both)

**Errors:**

| **Name** | **Description** |
| - | - |
| Json\_Error\_Open | Failed to open json file. |
| Json\_Error\_Write | Failed to write json key. |
| Json\_Error\_Save | Failed to save json to file. |

**Example:**

JSON:

```json theme={null}
{
    "catalog": {
        "bk101": {
            "author": "Gambardella, Matthew",
            "title": "XML Developer's Guide",
            "genre": "Computer",
            "price": 44.95,
            "publishDate": "2000-10-01",
            "description": "An in-depth look at creating applications with XML."
        }
    }
}
```

Workflow:

```json theme={null}
writeJsonValue:
  type: jsonWrite
  path: "{pathJoin:{userDesktop},test.json}"
  key: catalog.bk101.modifiedDate
  value: "2001-10-10"
```

### 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:**

```json theme={null}
implodeUponExit:
  type: implode
```

### iniRead

Reads a value from an ini file.

**Version:**  5.1

**Arguments:**

| **Name** | **Type** | **Description** | **Default** |
| - | - | - | - |
| escape | boolean | Convert escape character sequences `\r`, `\n`, `\t` to control characters, and `\\` to a single backslash `\` while loading keys and values from the ini file. | true |
| **path** | string | Path of the ini file to read. | |
| section | string | Section to read from. | global |
| **key** 1 | string | Key to read. | |
| **keys** 1 | string/array | Keys to read. | |
| read | string | Task to run when all keys were read successfully. | |
| notRead | string | Task to run when one or more keys were not read. | |

**Additional Notes:**

1. *key*  or *keys*  arguments are required (not both)

**Changes:**

* 7.2.108 - Added `escape` argument

**Status Variables:**

| **Name** | **Type** | **Description** |
| - | - | - |
| \* | string | Values that were read. |

**Errors:**

| **Name** | **Description** |
| - | - |
| Ini\_Error\_Open | Failed to open the ini file for reading. |

**Example:**

```json theme={null}
readValueFromIni:
  type: iniRead
  path: "{pathJoin:{userDesktop},test.ini}"
  section: Settings
  key: Option1
  complete: displayValueFromIni
displayValueFromIni:
  type: log
  message: "{this.parent.status.Option1}"
readValuesFromIni:
  type: iniRead
  path: "{pathJoin:{userDesktop},test.ini}"
  section: Settings
  keys:
    - Option1
    - Option2
  complete: displayValuesFromIni
displayValuesFromIni:
  type: log
  message: "{this.parent.status.Option1}{this.parent.status.Option2}"
```

### iniWrite

Writes a value to an ini file.

**Version:**  5.1

**Arguments:**

| **Name** | **Type** | **Description** | **Default** |
| - | - | - | - |
| escape | boolean | Convert control characters to character sequences `\r`, `\n`, `\t` , and `\\` while writing keys and values into the ini file. | true |
| **path** | string | Path of the ini file to write to. | |
| section | string | Section to write in. | global |
| **key** 1 | string | Key to write. | |
| **value** 1 | string | Value to write. | |
| **keyValuePairs** 1 | array | Block of key/value pairs to write. | |
| unicode2 | boolean | Write UTF-16 content, if the ini file does not exist. | |

**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:**

| **Name** | **Description** |
| - | - |
| Ini\_Error\_Open | Failed to open the ini file. |
| Ini\_Error\_Write | Failed to write the ini key. |
| Ini\_Error\_Save | Failed to write the ini file to disk. |

**Example:**

```json theme={null}
writeIniFile:
  type: iniWrite
  path: "{pathJoin:{userDesktop},test.ini}"
  section: Settings
  key: Option1
  value: Value1
writeMultipleToIniFile:
  type: iniWrite
  path: "{pathJoin:{userDesktop},test.ini}"
  section: Settings
  keyValuePairs:
    test1: test2
    test3: test4
    test5: 10.4
    test6: "{pathJoin:{moduleCurrentPath},testw.ini}"
```

### interopLoad

Loads an interop library.

**Version:**  5.1

**Arguments:**

| **Name** | **Type** | **Description** |
| - | - | - |
| **name** | string | Friendly name for the interop library. |
| **path** | string | Path to the interop library to be loaded. |
| store | string/array | Certificate store used to authenticate (default: application's default interop store) Predefined certificate stores: app: Application certificate store platform: System certificate store null: Empty certificate store |
| \* | key/value pairs | Options that get passed to interop as name.key = value |

**Changes:**

* 5.2: Added store argument

**Errors:**

| **Name** | **Description** |
| - | - |
| Interop\_Error\_Authenticate | Failed to authenticate the library. |
| Interop\_Error\_Load | Failed to load the library into memory. |

**Example:**

```json theme={null}
loadPriority:
  type: interopLoad
  name: priority
  path: "{pathJoin:{moduleDirectory},{libraryPrefix}priority.{libraryExtension}}"
```

### interopUnload

Unloads an interop library.

**Version:**  5.1

**Arguments:**

| **Name** | **Type** | **Description** |
| - | - | - |
| **name** 1 | string | Friendly name for the interop library. |
| **path** 1 | string | Path to the interop library to be unloaded. |

**Additional Notes:**

1. Must be the same value that was used for interopLoad.

**Errors:**

| **Name** | **Description** |
| - | - |
| Interop\_Error\_Unload | Failed to unload the library from memory. |

**Example:**

```json theme={null}
unloadPriority:
  type: interopUnload
  name: priority
  path: "{pathJoin:{moduleDirectory},{libraryPrefix}priority.{libraryExtension}}"
```

### launch

Launch an application.

**Version:**  5.1

**Supported OS:**

* Windows (not supported on UWP)
* macOS
* Linux

**Arguments:**

| **Name** | **Type** | **Description** | **Default** | |
| - | - | - | - | - |
| **path** | string | Path to application to run. | | |
| arguments | string/array | Arguments for the application. If the value is an array of strings, they are encapsulated by double quotes and combined. | | |
| captureOutput | boolean | Capture output and save to status variable. (macOS and Linux only) | false | |
| elevationRights | string | Required process elevation rights. "user": run as user "elevated": run as elevate user "asinvoker": run as the current process | user | |
| errorFlagsMap | object | Key/value pairs to match for an error condition. The key is an exit code flag and value is the error string. | | |
| errorMap | object | Key/value pairs to match for an error condition. The key is an exit code and the value is the error string. | | |
| errorOutputMap | object | Key/value pairs to match for an error condition. (macOS & Linux only) The key is a string to search for in stdout, and the value is the error string. | | |
| showWindow | boolean | Show window for the target application. (Windows only) | false | |
| successCode | integer/array | Return code indicating success. | 0 | |
| successOutput | array | List of any strings to search for in stdout, for successful completion. (macOS & Linux only) | | |
| verbose | boolean | Print out verbose debug information to log. | false | |
| waitForExit | boolean | Wait for the application to exit before completing. | false | |
| waitForVisible | boolean | Wait for the application UI to appear before completing. Ignored if any of `waitForExit` or `captureOutput` is set to true. | | false |
| waitForVisibleTimeout | number | Number of seconds to wait for the application UI before completing. The task completes successfully if the timeout expires. | 10 | |
| workingDirectory | string | Working directory for application. | | |
| warningFlagsMap | object | Key/value pairs to match for a warning condition. The key is an exit code flag and the value is the error string. | | |
| warningMap | object | Key/value pairs to match for a warning condition. The key is an exit code and the value is the error string. | | |

**Status Variables:**

| **Name** | **Type** | **Description** |
| - | - | - |
| path | string | Path of the application that was launched. |
| arguments | string | Arguments used to launch the application. |
| exitCode | number | Exit code from process if *waitForExit* is set to *true* . |
| output | string | Output from the process if *captureOutput* is set to *true* . |

**Errors:**

| **Name** | **Description** |
| - | - |
| Launch\_Error\_Run | Error occurred while launching process. |
| Launch\_Error\_UnknownCode | Process returned unknown error code. |

**Example:**

```json theme={null}
launchDontCareAboutReturn:
  type: launch
  path: "{pathJoin:{moduleDirectory},Downloads,popoff.exe}"
  waitForExit: false
launchCheckForExitCode:
  type: launch
  path: "{pathJoin:{moduleDirectory},Downloads,application.exe}"
  waitForExit: true
  successCode: 102
  errorMap:
    '101': Application_Error_101
    '102': Application_Error_102
launchCheckForStdout:
  type: launch
  path: "/my/path/to/mymacbinary"
  waitForExit: true
  successOutput:
    - COMPLETED SUCCESSFULLY
    - NO ERRORS
    - UPDATE SUCCESSFUL
  errorOutputMap:
    INVALID ACCESS: Application_Error_InvalidAccess
    BAD READ: Application_Error_CannotRead
launchWithAnalytics:
  type: launch
  path: "{pathJoin:{moduleDirectory},Downloads,popoff.exe}"
  waitForExit: false
  analytics:
    productName: "{productName:{this.status.path}}"
    companyName: "{companyName:{this.status.path}}"
    productVersion: "{productVersion:{this.status.path}}"
    fileVersion: "{fileVersion:{this.status.path}}"
```

### log

Logs a message to the debug log.

**Version:**  5.1

**Arguments:**

| **Name** | **Type** | **Description** |
| - | - | - |
| **message** | string/array of strings | Text to log. |

**Changes:**

* 6.1 - Argument message supports array of strings

**Example:**

```json theme={null}
logToDebugLog:
  type: log
  message: Hello world!
```

### macro

Load macros from a JSON URL or javascript object.

**Version:**  5.1

**Arguments:**

| **Name** | **Type** | **Description** | **Default** |
| - | - | - | - |
| **url** 1 | string | URL to JSON object to load | |
| **key** 1 | string | Macro name. | |
| **value** 1 | string/integer | Macro value. | |
| **keyValuePairs** 1 | object | Macro key/value pairs. | |
| store | string/array | Certificate store used to authenticate (default: "app") Predefined certificate stores: app: Application certificate store platform: System certificate store null: Empty certificate store If this value is defined, it forces authenticate to true and requires content to be signed regardless of the protocol used to deliver it. | |
| authenticate | boolean | Authenticates the signature in JSON content. By default, it will authenticate the JSON on an HTTP connection and will not authenticate the JSON on a HTTPS connection because it is already secure. It will not try to authenticate a connection to the local \{contentUrl} webserver. | |
| global | boolean | App-wide macro scope, otherwise the scope islocal to the current workflow. | false |

**Additional Notes:**

1. *url*  or *key/value* or*keyValuePairs* arguments are required (not all)

**Changes:**

* 5.2 - Added store, authenticate arguments

**Errors:**

| **Name** | **Description** |
| - | - |
| Macro\_Error\_Parse | Failed to parse remote content. |
| WebGet\_Error\_\* | WebGet errors. |
| Platform\_Error\_\* | Platform errors. |

**Changes:**

* 5.2 - Removed Macro\_Error\_Request error

**Remote Example:**

```json theme={null}
loadRemoteMacros:
  type: macro
  url: "{contentUrl}mymacros.json"
  complete: useMacro
useMacro:
  loadEnvironment: "{environmentName}"
```

mymacros.json

```json theme={null}
{
    "environmentName": "live"
}
```

**Local Example:**

```json theme={null}
loadLocalMacros:
  type: macro
  keyValuePairs:
    environmentName: Windows NT
    environmentType: VirtualMachine
```

### msi

Runs an MSI installer.

**Version:**  5.1

**Supported OS:**

* Windows (not supported on UWP)

**Arguments:**

| **Name** | **Type** | **Description** | **Default** |
| - | - | - | - |
| **path** | string | Path to the .msi installer file. | |
| silent | boolean | Silent install. | true |
| properties | object | Custom key/value pair properties for the installer. Your specific MSI installer must support these. Values cannot contain spaces. | |
| reportStatus | boolean | Shows MSI status for the task. | true |
| reportProgress | boolean | Shows MSI progress for the task. | true |
| logFilename | string | Filename to where the .msi should save a log to. | |

**Errors:**

| **Name** | **Description** |
| - | - |
| Msi\_Error\_Install | An installer error has occurred. |

**Example:**

```json theme={null}
installDownload:
  type: msi
  silent: true
  path: "{this.parent.status.outputPath}"
```

### 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:**

| **Name** | **Type** | **Description** |
| - | - | - |
| **event** | string | Notification event following the format: *Type.Notification* . |
| delay | number | Number of milliseconds to delay the event from being fired. |
| content | object/string | Object or string containing information to send in event. |

**Example:**

workflow\.yaml:

```json theme={null}
sendNotify:
  type: notification
  event: Yahoo.XYZ
  content:
    xyz: true
    filename: "{moduleFilename}"
```

main.js:

```javascript theme={null}
notificationCenter.addObserver("Yahoo", "XYZ", function(sender, info) {
    console.log("Triggered Yahoo.XYZ");
    console.log(sender);
    console.log(info);
});
```

### numberCompare

Compare two numbers.

**Version:**  5.1

**Arguments:**

| **Name** | **Type** | **Description** |
| - | - | - |
| **numberOne** | number/string | First number in comparison. |
| **numberTwo** | number/string | Second number in comparison. |
| equalTo | string | Task to run when numbers match. |
| notEqualTo | string | Task to run when numbers do not match. |
| greaterThan | string | Task to run when first number is greater than number version. |
| lessThan | string | Task to run when first number is less than number version. |

**Example:**

```json theme={null}
areOn64Bit:
  type: numberCompare
  numberOne: "{systemBitness}"
  numberTwo: 64
  equalTo: install64BitProduct
  notEqualTo: areOn32Bit
```

### pkg

Runs a PKG installer. This task inherits the arguments of the *launch*  task.

**Version:**  5.1

**Supported OS:**

* macOS

**Arguments:**

| **Name** | **Type** | **Description** | **Default** |
| - | - | - | - |
| **path** | string | Path to the .pkg installer file. | |
| arguments | string/array | Arguments for the installer. If the value is an array of strings, they are encapsulated by double quotes and combined. | |
| logFilename | string | Filename to where the .pkg should save a log to. | |
| logOnlyErrors | boolean | Only log the errors to the log file. | false |

**Example:**

```json theme={null}
installDownload:
  type: pkg
  path: "{pathJoin:{this.parent.status.OutputDirectory},Application1.pkg}"
  elevationRights: elevated
```

### plistRead

Reads values from a property list file.

**Version:**  5.1

**Arguments:**

| **Name** | **Type** | **Description** |
| - | - | - |
| **path** | string | Path to the plist file to read from. |
| **key** 1 | string | Key to read. |
| **keys** 1 | array of strings | Keys to read. |
| read | string | Task to run when all keys were read successfully. |
| notRead | string | Task to run when one or more keys were not read. |

**Additional Notes:**

1. *key* /*value*  or *keys* arguments are required (not both)

**Status Variables:**

| **Name** | **Type** | **Description** |
| - | - | - |
| \* | string | Values that were read. |

**Errors:**

| **Name** | **Description** |
| - | - |
| Plist\_Error\_Open | Failed to open plist file. |

**Example:**

```json theme={null}
readProductInfo:
  type: plistRead
  path: "{userDesktop}info.plist"
  keys:
    - CFBundleName
    - CFBundleVersion
  complete: logProductInfo
logProductInfo:
  type: log
  message: "{this.parent.status.CFBundleName} {this.parent.status.CFBundleVersion}"
```

### plistWrite

Adds or edits values in a property list file.

**Version:**  5.1

**Arguments:**

| **Name** | **Type** | **Description** |
| - | - | - |
| **path** | string | Path to the plist file to write to. |
| **key** 1 | string | Key to write. |
| **value** 1 | string/integer | Value to write. |
| **keyValuePairs** 1 | key value pairs | Block of key/value pairs to write. |

**Additional Notes:**

1. *key* /*value*  or *keyValuePairs*  arguments are required (not both)

**Errors:**

| **Name** | **Description** |
| - | - |
| Plist\_Error\_Open | Failed to open plist file. |
| Plist\_Error\_Write | Failed to write plist key. |
| Plist\_Error\_Save | Failed to save plist to file. |

**Example:**

```json theme={null}
writeProductInfo:
  type: plistWrite
  path: "{pathJoin:{userDesktop},info.plist}"
  key: CFBundleName
  value: "1.0"
writeProductInfos:
  type: plistWrite
  path: "{pathJoin:{userDesktop},info.plist}"
  keyValuePairs:
    CFBundleName: host
    CFBundleVersion: "1.0"
```

### preferencesDelete

Delete a preferences key.

**Version:**  8.0.52

**Supported OS:**

* macOS

**Arguments:**

| **Name** | **Type** | **Description** | **Default** |
| - | - | - | - |
| domain | string | Application id | Uses app bundle id |
| **location** | string | Location in the domain of the key. | |
| **key** | string | Key to delete. | |
| failIfMissing | boolean | Reports an error when the key does not exist. | false |

**Errors:**

| **Name** | **Description** |
| - | - |
| Preferences\_Error\_Delete | Failed to delete the preferences key. |

**Example:**

```json theme={null}
removeFromPrefs:
  type: preferencesDelete
  domain: com.mycompany
  location: myApp
  key: mySetting
```

### preferencesExists

Check if a preferences key exists.

**Version:**  8.0.52

**Supported OS:**

* macOS

**Arguments:**

| **Name** | **Type** | **Description** | **Default** |
| - | - | - | - |
| domain | string | Application id | Uses app bundle id |
| **location** | string | Location in the domain of the key. | |
| key | string | Key to check for existence. | |
| exists | string | Task to run if the registry key exists. | |
| missing | string | Task to run if the registry key does not exist. | |

**Example:**

```json theme={null}
checkAppIsInstalled:
  type: preferencesExist
  location: myApp
  key: mySetting
  exists: isInstalled
  missing: isNotInstalled
```

### preferencesRead

Reads a preference.

**Version:**  8.0.52

**Supported OS:**

* macOS

**Arguments:**

| **Name** | **Type** | **Description** | **Default** |
| - | - | - | - |
| domain | string | Application id | Uses app bundle id |
| **location** | string | Location in the domain of the key. | |
| **key** 1 | string | Key to read. | |
| **keys** 1 | array of strings | Keys to read. | |
| read | string | Task to run when all keys were read successfully. | |
| notRead | string | Task to run when one or more keys were not read. | |

**Additional Notes:**

1. *key* /*value*  or *keys* arguments are required (not both)

**Status Variables:**

| **Name** | **Type** | **Description** |
| - | - | - |
| \* | string | Values that were read. |

**Example:**

```json theme={null}
readProductVersion:
  type: preferencesRead
  location: myApp
  key: installedVersion
  success: compareProductVersion
compareProductVersion:
  type: stringCompare
  stringOne: "1.0"
  stringTwo: "{this.parent.status.InstalledVersion}"
  equalTo: weHaveLatestVersion
```

### preferencesWrite

Adds or edits preferences.

**Version:**  8.0.52

**Supported OS:**

* macOS

**Arguments:**

| **Name** | **Type** | **Description** | **Default** |
| - | - | - | - |
| **domain** | string | Application id | Uses app bundle id |
| **location** | string | Location in the domain of the key. | |
| **key** 1 | string | Key to write. | |
| **value** 1 | string/integer | Value to write. | |
| **keyValuePairs** 1 | key value pairs | Block of key/value pairs to write. | |
| onlyIfExists | boolean | Only writes the registry value if it already exists (update-only). | false |

**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:**

| **Name** | **Description** |
| - | - |
| Preferences\_Error\_Write | Failed to write the preferences key. |

**Example:**

```json theme={null}
addProductVersion:
  type: preferencesWrite
  location: myApp
  key: InstalledVersion
  value: "{appVersion}"
addProductInfo:
  type: preferencesWrite
  location: myApp
  keyValuePairs:
    Name: Application1
    InstalledVersion: "{appVersion}"
```

### 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:**

| **Name** | **Type** | **Description** |
| - | - | - |
| path1 | string | Full path or filename of the executable. |
| id1 | integer | Process id. |
| running | string | Task to run when program is running. |
| notRunning | string | Task to run when program is not running. |

**Status Variables:**

| **Name** | **Type** | **Description** |
| - | - | - |
| id | integer | Process id found |

**Additional Notes:**

1. *path*  or *id* arguments are required (not both)

**Changes:**

* 6.1 - Added id argument to search for process by id

**Example:**

```json theme={null}
isProcessRunning:
  type: processIsOpen
  path: C:\path\to\program.exe
  notRunning: launchProcess
  running: displayAlreadyRunning
```

### processList

Enumerates processes.

**Version:**  5.2

**Arguments:**

| **Name** | **Type** | **Description** |
| - | - | - |
| parentId | integer | Only return children of a particular process ID, optional. |
| path | string | Only return processes matching a particular directory or filename. Supports wildcards. |
| **forEach** | string | Task to run when a process is found. |

**Status Variables:**

| **Name** | **Type** | **Description** |
| - | - | - |
| directory | string | Process directory |
| path | string | Full path to the process. |
| name | string | Process file name |
| id | integer | ID of process |
| parentId | integer | ID of parent process |

**Changes:**

* 6.1 - Added path argument.

**Example:**

Enumerate all children:

```json theme={null}
start:
  type: processList
  next: logProcessEntry
logProcessEntry:
  type: log
  message: Process - {this.parent.status.id} - {this.parent.status.path}
```

Enumerate all children of a certain process recursively:

```json theme={null}
start:
  type: processList
  parentId: 56008
  forEach: logProcessEntry
logProcessEntry:
  type: log
  message: "{this.parent.status.id} - {this.parent.status.path}"
  complete: nextChildren
nextChildren:
  type: processList
  parentId: "{this.parent.parent.status.id}"
  forEach: logProcessEntry
```

### 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:**

| **Name** | **Type** | **Description** | **OS Support** |
| - | - | - | - |
| **path** | string | Path to the file/URL/executable to open. | |
| arguments | key/value pairs | Arguments to pass to executable. | Not supported on Linux. |
| environmentVariables | key/value pairs | Environment variables to pass to the executable. | Only natively supported on macOS and simulated on other platforms. |
| displayErrors | boolean | Display OS errors | Supported only on macOS. |
| allowMultipleInstances | boolean | Allow multiple instances to open | Supported only on macOS. |

**Status Variables:**

| **Name** | **Type** | **Description** |
| - | - | - |
| path | string | Expanded path used in the arguments |

**Errors:**

| **Name** | **Description** |
| - | - |
| ProcessOpen\_Error\_Shell | Failed to open the specified file. |

**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:**

```json theme={null}
browseToGoogle:
  type: processOpen
  path: http://www.google.com
```

### 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:**

| **Name** | **Type** | **Description** |
| - | - | - |
| **id** | integer/string | ID of the process to close. |
| exitCode | integer | Exit code to terminate the process with. (Windows only) |
| closed | string | Task to run when program is closed. |
| notClosed | string | Task to run when program is not closed. |
| waitForClose | integer/string | Number of seconds to wait before terminating a program after attempt to close a program gracefully if greater than zero. *exitCode* is not set if program was not gracefully closed. |

**Changes:**

* 6.1 - Added waitForClose argument

**Example:**

```json theme={null}
tryProcessClose:
  type: processClose
  id: "{this.parent.status.id}"
  waitForClose: 20
```

### progress

Unified progress for multiple tasks. See the [unified progress bar documentation](https://docs.directgvr.com/reference/client-workflow-engine/progress.md).

**Version:**  5.1

### queue

Queue of workflow tasks to run.

**Version:**  5.1

**Arguments:**

| **Name** | **Type** | **Description** |
| - | - | - |
| **actions** | array of strings | List of task names to be executed. |

**Status Variables:**

| **Name** | **Type** | **Description** |
| - | - | - |
| totalActions | integer | Total number of actions |
| completeActions | integer | Total number of actions complete |
| currentAction | integer | Index of action currently being processed. |

**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:**

```json theme={null}
start:
  type: queue
  actions:
    - taskOne
    - taskTwo
    - taskThree
```

### registryKeyCreate

Create a registry key.

**Version:**  5.1

**Supported OS:**

* Windows (not supported on UWP)

**Arguments:**

| **Name** | **Type** | **Description** |
| - | - | - |
| **hive** | string | Registry hive user machine root config desktopuser |
| **location** | string | Location of the registry key. |
| view | string | Registry view. default 32 64 |

**Errors:**

| **Name** | **Description** |
| - | - |
| RegistryKey\_Error\_Create | Failed to create the registry key. |

**Changes:**

* 7.0 - Remove support for macOS

**Example:**

```json theme={null}
addAppToRegistry:
  type: registryKeyCreate
  hive: machine
  location: SOFTWARE\Application1
```

### registryKeyDelete

Delete a registry key or registry value.

**Version:**  5.1

**Supported OS:**

* Windows (not supported on UWP)

**Arguments:**

| **Name** | **Type** | **Description** | **Default** |
| - | - | - | - |
| **hive** | string | Registry hive. user machine root config desktopuser | |
| **location** | string | Location of the registry key. | |
| value | string/array of strings | Registry value to delete. | |
| view | string/array of strings | Registry view. default 32 64 If an array of strings, the first registry view with the key found will be deleted. | |
| failIfMissing | boolean | Reports an error when the key does not exist. | false |

**Errors:**

| **Name** | **Description** |
| - | - |
| RegistryKey\_Error\_Delete | Failed to delete the registry key. |

**Changes:**

* 6.1 - Support multiple views
* 7.0 - Remove support for macOS
* 7.1 - Added value argument

**Example:**

```json theme={null}
removeAppFromRegistry:
  type: registryKeyDelete
  hive: machine
  location: SOFTWARE\Application1
```

### registryKeyExists

Check if a registry key exists.

**Version:**  5.1

**Supported OS:**

* Windows (not supported on UWP)

**Arguments:**

| **Name** | **Type** | **Description** |
| - | - | - |
| **hive** | string | Registry hive. user machine root config desktopuser |
| **location** | string | Location of the registry key. |
| view | string/array of strings | Registry view. default 32 64 If an array of strings, the first registry view with the key found will indicate success. |
| exists | string | Task to run if the registry key exists. |
| missing | string | Task to run if the registry key does not exist. |

**Changes:**

* 6.1 - Support multiple views
* 7.0 - Remove support for macOS

**Example:**

```json theme={null}
checkAppIsInstalled:
  type: registryKeyExists
  hive: machine
  location: SOFTWARE\Application1
  exists: isInstalled
  missing: isNotInstalled
```

### registryKeyRead

Reads registry keys.

**Version:**  5.1

**Supported OS:**

* Windows (not supported on UWP)

**Arguments:**

| **Name** | **Type** | **Description** |
| - | - | - |
| **hive** | string | Registry hive. user machine root config desktopuser |
| **location** | string | Location of the registry key. |
| **key** 1 | string | Key to read. |
| **keys** 1 | array of strings | Keys to read. |
| view | string/array of strings | Registry view. default 32 64 If an array of strings, the first registry view with a value found will be returned. |
| security | string | Security group to add the key. default everybody |
| read | string | Task to run when all keys were read successfully. |
| notRead | string | Task to run when one or more keys were not read. |

**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:**

| **Name** | **Type** | **Description** |
| - | - | - |
| \* | string | Values that were read. |

**Example:**

```json theme={null}
readProductVersion:
  type: registryKeyRead
  hive: machine
  location: SOFTWARE\Application1
  key: installedVersion
  success: compareProductVersion
compareProductVersion:
  type: stringCompare
  stringOne: "1.0"
  stringTwo: "{this.parent.status.InstalledVersion}"
  equalTo: weHaveLatestVersion
```

### registryKeyWrite

Adds or edits registry keys.

**Version:**  5.1

**Supported OS:**

* Windows (not supported on UWP)

**Arguments:**

| **Name** | **Type** | **Description** | **Default** |
| - | - | - | - |
| **hive** | string | Registry hive. user machine root config desktopuser | |
| **location** | string | Location of the registry key. | |
| **key** 1 | string | Key to write. | |
| **value** 1 | string/integer | Value to write. | |
| **keyValuePairs** 1 | key value pairs | Block of key/value pairs to write. | |
| view | string | Registry view. default 32 64 | |
| security | string | Security group to add the key. default everybody | |
| onlyIfExists | boolean | Only writes the registry value if it already exists (update-only). | false |

**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:**

| **Name** | **Description** |
| - | - |
| RegistryKey\_Error\_Write | Failed to write the registry key. |

**Changes:**

* 6.1 - Added onlyIfExists argument
* 7.0 - Remove support for macOS

**Example:**

```json theme={null}
addProductVersion:
  type: registryKeyWrite
  hive: machine
  location: SOFTWARE\Application1
  key: InstalledVersion
  value: "{appVersion}"
addProductInfo:
  type: registryKeyWrite
  hive: machine
  location: SOFTWARE\Application1
  keyValuePairs:
    Name: Application1
    InstalledVersion: "{appVersion}"
```

### repository\*

The following arguments are shared among the *repositorySync/repositoryCheck/repositoryErase*  tasks.

**Arguments:**

| **Name** | **Type** | **Description** | **Default** |
| - | - | - | - |
| alias | string | URL to the alias file. | alias.url |
| authenticate | boolean | Authenticate the signature in JSON content. By default, it will authenticate the JSON on an HTTP connection and will not authenticate the JSON on a HTTPS connection because it is already secure. It will not try to authenticate a connection to the local \{contentUrl} webserver. | true |
| autoMask | boolean | Automatically determine mask from source and target metafiles when mask is not available from catalog. | true |
| catalog | string | URL to catalog file. | catalog.url |
| cleanup | boolean | Remove files no longer needed to sync (removed files, backup files, etc).1 | true |
| deltaCacheSize | integer | Cached read buffer (in bytes) used during delta operations. Stops delta operations from having to re-read recently read bytes. | storage.cacheSize |
| local | storage container | Final asset destination | |
| fileCompletes | integer | Maximum number of concurrent file completes. | |
| inplace | boolean | Move assets from the pending directory to the final asset destination. | true |
| mask | string | Base64 encoded bitfield used to mask the pieces in a sync. | |
| metafile | string | Local path used to save the metafile. | |
| metafileSave | boolean | Save metafile when sync is finished. | true |
| pending | storage container | Storage container for pending pieces. | |
| phases | phases container | Configure progress status/weighting based on phases. | |
| stallTime | integer | Number of seconds to wait for successful activity before displaying an error. | 60 for repositorySync, 30 for repositoryCheck |
| stallTimeout | integer | Number of seconds to wait for successful activity before failing the task. | No timeout, will retry continually until complete. |
| requests | integer | Maximum number of concurrent storage requests. | storage.requests |
| repository | string | Name of the repository. | |
| remote | storage container | Remote location of repository - merged from the catalog request. | |

**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

| **Property** | **Type** | **Description** |
| - | - | - |
| apply | phase container | Configure the apply phase. This phase is used to apply deltas after the initial expansion. |
| clean | phase container | Configure the clean phase. This phase is used to remove files were deleted between releases. |
| copy | phase container | Configure the copy/download phase. This phase is used to transfer data onto the local machine. |

**Phase Container**

| **Property** | **Type** | **Description** |
| - | - | - |
| status | string | Status used by workflow when phase begins. |
| weight | number | Weighted progress (for example 0.2). All the phases configured are totaled and the percentage of this number is used to calculate the current progress. |

**Example:**

```json theme={null}
...
phases:
  copy:
    status: UI_Copying
    weight: 0.8
  apply:
    status: UI_Applying
    weight: 0.12
  clean:
    status: UI_Cleaning
    weight: 0.08
...
```

#### Storage container

In the workflow, storage containers are *local* , *backup* , *pending*  and *remote* .

| **Property** | **Type** | **Valid Containers** | **Valid Storage Types** | **Description** | **Default** |
| - | - | - | - | - | - |
| flags | integer/string | all | httpPiece | Repository attributes Integer: (0x1: Pad) (0x2: Gzip) (0x4: VCDiff) (0x08: AES256) String: pad, gzip, vcdiff, aes256 | |
| type | string | all | all | Type of storage container (Basic Types: "file", "filePiece", "http", "httpPiece") | |
| id | string | remote | all | Remote release id to use for the repository. When specified the alias URL will not be used to resolve the release id. | |
| ignore | string | all | file | `[ "471KB.dat", "directory/test.txt" ]` | |
| partialExtension | string | all | file | Extension added when file is not completed. | storage.partialExtension |
| path | string | all | file, filePiece | File path where repository is stored. | |
| selfUpdate | boolean | all | file | Flag a file system to allow self-update. | storage.selfUpdate |
| skipAttributes | boolean | all | file | Skip file attribute updating when available. | storage.skipAttributes |
| skipTimestamp | boolean | all | file | Skip setting file timestamp information when available. | storage.skipTimestamp |
| systemBuffer | boolean | all | file, filePiece | Use the global system disk cache. | storage.systemBuffer |
| url | string | all | http, httpPiece | Url where the repository is stored. | |

**Status Variables:**

It's recommend to rely only on the top level items, items in the sub levels are for internal usage and debugging.

| **Name** | **Type** | **Description** |
| - | - | - |
| actionFlags | number | Pending actions (Documented in Repository Configuration) |
| active | boolean | True if repository active, false otherwise |
| aliasLoadTime | number | Time loading alias (Seconds.Milliseconds) |
| alias.errorCode | number | (internal use) Last primary error code for alias |
| alias.errorCodeEx | number | (internal use) Last secondary error code for alias |
| alias.errorCount | number | (internal use) Error count for alias |
| alias.resumeTime | number | (internal use) Unix epoch representing next retry |
| aliveTime | number | Time spent in alive state (Seconds.Milliseconds) |
| apply.bytesComplete | number | Number of bytes complete in the apply phase (Excludes mask) |
| apply.bytesMasked | number | Number of bytes masked in the apply phase |
| apply.bytesRemaining | number | Number of bytes remaining in the apply phase |
| apply.bytesSkipped | number | Number of bytes masked in the apply phase |
| apply.bytesTotal | number | Total number of bytes in the apply phase |
| apply.bytesWritten | number | Number of bytes written in the apply phase |
| apply.flags | number | (internal use) Storage apply flags |
| apply.fileCompleteLastTime | number | Unix epoch representing last time a file was completed in the apply phase |
| apply.filesComplete | number | Number of files complete in the apply phase |
| apply.filesPending | number | Number of files pending in the apply phase |
| apply.filesPendingInFlight | number | Number of file completes active in the apply phase |
| apply.filesTotal | number | Number of files in copy in the apply phase |
| apply.remainingTime | number | Remaining time in the apply phase (-1 = indeterminate) |
| apply.pieceAverageTime | number | Average time per piece in the apply phase (Seconds.Milliseconds) |
| apply.pieceCompleteLastTime | number | Unix epoch representing last time a piece was completed in the apply phase |
| apply.piecesComplete | number | Number of pieces complete in the apply phase (Excludes mask) |
| apply.pieceLength | number | (Internal use) Piece length according to the source metafile |
| apply.piecesMasked | number | Number of pieces masked in the apply phase |
| apply.piecesSkipped | number | Number of pieces skipped in the apply phase |
| apply.piecesTotal | number | Total number of pieces in the apply phase |
| apply.piecesWritten | number | Number of pieces written in the apply phase |
| apply.progress | number | Apply phase percent complete |
| canPauseResume | boolean | True if the repository can pause or resume, false otherwise |
| catalogLoadTime | number | Time loading catatog (Seconds.Milliseconds) |
| catalog.errorCode | number | (internal use) Last primary error code for catalog |
| catalog.errorCodeEx | number | (internal use) Last secondary error code for catalog |
| catalog.errorCount | number | (internal use) Error count for catalog |
| catalog.resumeTime | number | (internal use) Unix epoch representing next retry |
| cleanupLocal.itemAverageTime | number | Average time to process item |
| cleanupLocal.filesErased | number | Number of local storage container files erased |
| cleanupLocal.itemsComplete | number | Number of local storage container items complete |
| cleanupLocal.itemsTotal | number | Total items to cleanup |
| cleanupLocal.progress | number | Local storage container cleanup percent complete |
| cleanupLocal.remainingTime | number | Time left to cleanup local storage container files |
| cleanupPending.itemAverageTime | number | Average time to process item |
| cleanupPending.filesErased | number | Number of pending storage container files erased |
| cleanupPending.itemsComplete | number | Number of pending storage container items complete |
| cleanupPending.itemsTotal | number | Total pending storage container items to cleanup |
| cleanupPending.progress | number | Pending storage container cleanup percent complete |
| cleanupPending.remainingTime | number | Time left to cleanup pending storage container files |
| completeBytes | number | Number of bytes complete in the repository |
| copy.bytesComplete | number | Number of bytes complete in the copy phase (Excludes mask) |
| copy.bytesMasked | number | Number of bytes masked in the copy phase |
| copy.bytesRemaining | number | Number of bytes remaining in the copy phase |
| copy.bytesSkipped | number | Number of bytes masked in the copy phase |
| copy.bytesTotal | number | Total number of bytes in the copy phase |
| copy.bytesWritten | number | Number of bytes written in the copy phase |
| copy.flags | number | (internal use) Storage copy flags |
| copy.fileCompleteLastTime | number | Unix epoch representing last time a file was completed in the copy phase |
| copy.filesComplete | number | Number of files complete in the copy phase |
| copy.filesPending | number | Number of files pending in the copy phase |
| copy.filesPendingInFlight | number | Number of file completes active in the copy phase |
| copy.filesTotal | number | Number of files in copy in the copy phase |
| copy.remainingTime | number | Remaining time in the copy phase (-1 = indeterminate) |
| copy.pieceAverageTime | number | Average time per piece in the copy phase (Seconds.Milliseconds) |
| copy.pieceCompleteLastTime | number | Unix epoch representing last time a piece was completed in the copy phase |
| copy.piecesComplete | number | Number of pieces complete in the copy phase (Excludes mask) |
| copy.pieceLength | number | (Internal use) Piece length according to the source metafile |
| copy.piecesMasked | number | Number of pieces masked in the copy phase |
| copy.piecesSkipped | number | Number of pieces skipped in the copy phase |
| copy.piecesTotal | number | Total number of pieces in the copy phase |
| copy.piecesWritten | number | Number of pieces written in the copy phase |
| copy.progress | number | Copy phase percent complete |
| deltaFailures | number | Number of delta failures |
| delta.cache.hits | number | Number of cache hits |
| delta.cache.readBytes | number | Number of bytes read from cache |
| delta.cache.misses | number | Number of cache misses |
| delta.cache.size | number | Delta read cache size |
| delta.cache.used | number | Bytes used for read cache |
| delta.readBytes | number | Number of bytes read by delta (includes cached bytes) |
| eraseTime | number | Time spent in erase state |
| errorCount | number | Number of errors |
| lastErrorCode | number | Primary error code |
| lastErrorCodeEx | number | Secondary error code |
| lastErrorIndex | number | Piece index for error code (-1 for n/a) |
| lastErrorSource | number | Source of the error alias: 1 catalog: 2 metafileLocal: 3 metafileRemote: 4 storageLocal: 5 storageRemote: 6 storageDelta: 7 storagePending: 8 config: 9 |
| lastErrorType | number | Type of error get: 1 put: 3 loading: 5 delete: 4 |
| localId | string | Local release id (empty if not updating) |
| localCleanTime | number | Time cleaning local storage container (Seconds.Milliseconds) |
| localMaxReadSpeed | number | Maximum BPS read from local storage container |
| localMaxWriteSpeed | number | Maximum BPS written to local storage container |
| localMetaFileLoadTime | number | Time loading local metafile (Second.Milliseconds) |
| localMetaFile.errorCode | number | (internal use) Last primary error code for local metafile |
| localMetaFile.errorCodeEx | number | (internal use) Last secondary error code for local metafile |
| localMetaFile.errorCount | number | (internal use) Error count for local metafile |
| localMetaFile.resumeTime | number | (internal use) Unix epoch representing next retry |
| localMetaFile.totalLength | number | Total length for all files in the local metafile |
| localMetaFile.totalPadding | number | Total padding for all files in the local metafile |
| localReadBytes | number | Number of bytes read from local storage container |
| localReadSpeed | number | Current BPS read from local storage container |
| localWriteBytes | number | Number of bytes written to local storage container |
| localWriteSpeed | number | Current BPS written to local storage container |
| local.extraFileFlags | number | Extra file flags used when opening files belonging to the storage container (file, filePiece containers only) |
| local.lockDirectory | string | Directory used during self update for locked files (file container only) |
| local.id | string | Storage container instance id |
| local.errorCount | number | Number of errors for the storage container |
| local.lastError | number | Last http primary request error (http, httpPiece containers only) |
| local.lastErrorEx | number | Last http secondary request error (http, httpPiece containers only) |
| local.maxReadSpeed | number | Max BPS read from the storage container |
| local.maxWriteSpeed | number | Max BPS written to the storage container |
| local.openFiles | number | Total open files in storage container (file container only) |
| local.outputPath | string | Container storage directory (file, filePiece containers only) |
| local.partialExtension | string | File extension for partial files (file container only) |
| local.pieceFormat | string | File locations for storage container (filePiece container only) |
| local.pendingRequests | number | Number of pending requests in the storage container |
| local.readBytes | number | Number of bytes read from the storage container |
| local.readSpeed | number | Current BPS read from the storage container |
| local.type | string | Type of storage container (file, filePiece, http, httpPiece) |
| local.writeBytes | number | Number of bytes written to the storage container |
| local.writeSpeed | number | Current BPS written to local storage container |
| local.url | string | Base request url (http, httpPiece containers only) |
| name | string | Repository name |
| paused | boolean | True if repository paused, false otherwise |
| pauseTime | number | Time spent in pause state (Seconds.Milliseconds) |
| pendingCleanTime | number | Time cleaning pending storage container (Seconds.Milliseconds) |
| pending.extraFileFlags | number | Extra file flags used when opening files belonging to the storage container (file, filePiece containers only) |
| pending.lockDirectory | string | Directory used during self update for locked files (file container only) |
| pending.id | string | Storage container instance id |
| pending.errorCount | number | Number of errors for the storage container |
| pending.lastError | number | Last http primary request error (http, httpPiece containers only) |
| pending.lastErrorEx | number | Last http secondary request error (http, httpPiece containers only) |
| pending.maxReadSpeed | number | Max BPS read from the storage container |
| pending.maxWriteSpeed | number | Max BPS written to the storage container |
| pending.openFiles | number | Total open files in storage container (file container only) |
| pending.outputPath | string | Container storage directory (file, filePiece containers only) |
| pending.partialExtension | string | File extension for partial files (file container only) |
| pending.pieceFormat | string | File locations for storage container (filePiece container only) |
| pending.pendingRequests | number | Number of pending requests in the storage container |
| pending.readBytes | number | Number of bytes read from the storage container |
| pending.readSpeed | number | Current BPS read from the storage container |
| pending.type | string | Type of storage container (file, filePiece, http, httpPiece) |
| pending.writeBytes | number | Number of bytes written to the storage container |
| pending.writeSpeed | number | Current BPS written to local storage container |
| pending.url | string | Base request url (http, httpPiece containers only) |
| phases | string list | Phases required to complete (valid strings: copy, apply, clean) copy: copy from remote → local/pending apply: copy from pending → local clean: cleanup (local/pending) |
| pieceAverageTime | number | Average time per piece (Seconds.Milliseconds) |
| piecesComplete | number | Number of pieces complete (Excludes mask) |
| piecesMasked | number | Number of pieces masked |
| piecesSkipped | number | Number of pieces skipped |
| piecesTotal | number | Total number of pieces |
| piecesWritten | number | Number of pieces written |
| progress | number | Repository percent complete |
| refreshTime | number | Time spent in refresh state (Seconds.Milliseconds) |
| remainingBytes | number | Number of remaining bytes in the repository |
| remainingTime | number | Remaining time for the entire repository sync/erase (-1 = indeterminate) |
| remoteId | string | Remote release id |
| remoteMaxReadSpeed | number | Maximum BPS read from remote storage container |
| remoteMaxWriteSpeed | number | Maximum BPS written to remote storage container |
| remoteMetaFileLoadTime | number | Time to load remote metafile (Seconds.Milliseconds) |
| remoteMetaFile.errorCode | number | (internal use) Last primary error code for remote metafile |
| remoteMetaFile.errorCodeEx | number | (internal use) Last secondary error code for remote metafile |
| remoteMetaFile.errorCount | number | (internal use) Error count for remote metafile |
| remoteMetaFile.resumeTime | number | (internal use) Unix epoch representing next retry |
| remoteMetaFile.totalLength | number | Total length for all files in the remote metafile |
| remoteMetaFile.totalPadding | number | Total padding for all files in the remote metafile |
| remoteReadBytes | number | Number of bytes read from remote storage container |
| remoteReadSpeed | number | Current BPS read from remote storage container |
| remoteWriteBytes | number | Number of bytes written to remote storage container |
| remoteWriteSpeed | number | Current BPS written to remote storage container |
| remote.\[0].extraFileFlags | number | Extra file flags used when opening files belonging to the storage container (file, filePiece containers only) |
| remote.\[0].lockDirectory | string | Directory used during self update for locked files (file container only) |
| remote.\[0].id | string | Storage container instance id |
| remote.\[0].errorCount | number | Number of errors for the storage container |
| remote.\[0].lastError | number | Last http primary request error (http, httpPiece containers only) |
| remote.\[0].lastErrorEx | number | Last http secondary request error (http, httpPiece containers only) |
| remote.\[0].maxReadSpeed | number | Max BPS read from the storage container |
| remote.\[0].maxWriteSpeed | number | Max BPS written to the storage container |
| remote.\[0].openFiles | number | Total open files in storage container (file container only) |
| remote.\[0].outputPath | string | Container storage directory (file, filePiece containers only) |
| remote.\[0].partialExtension | string | File extension for partial files (file container only) |
| remote.\[0].pieceFormat | string | File locations for storage container (filePiece container only) |
| remote.\[0].pendingRequests | number | Number of pending requests in the storage container |
| remote.\[0].readBytes | number | Number of bytes read from the storage container |
| remote.\[0].readSpeed | number | Current BPS read from the storage container |
| remote.\[0].type | string | Type of storage container (file, filePiece, http, httpPiece) |
| remote.\[0].writeBytes | number | Number of bytes written to the storage container |
| remote.\[0].writeSpeed | number | Current BPS written to local storage container |
| remote.\[0].url | string | Base request url (http, httpPiece containers only) |
| requests.\[0].active | boolean | True if active, false otherwise |
| requests.\[0].allowVCDiff | boolean | True if vcdiff is allowed, false otherwise |
| requests.\[0].index | number | Piece index |
| requests.\[0].resumeTime | number | Unix epoch representing the next time the request might be used |
| requests.\[0].state | number | Storage request state |
| stallTime | number | Time spent in stalled state (Seconds.Milliseconds) |
| stateFlags | number | Repository state (Documented in Repository Configuration) |
| status | string | Repository status |
| supportPause | bool | Task supports pause, always true |
| supportResume | bool | Task supports resume, always true |
| syncTime | number | Time spent in sync state (Seconds.Milliseconds) |
| totalBytes | number | Total bytes in repository |

### repositoryCheck

Checks to see if an existing repository needs to be updated.

**Version:**  5.1

**Arguments:**

| **Name** | **Type** | **Description** |
| - | - | - |
| check | boolean | Dry run - only check if update needs to occur. |
| install | string | Task to run if an install is required. |
| update | string | Task to run if an update is required. |
| upToDate | string | Task to run if an install or update is not required. |
| store | string/array | Certificate store used to authenticate (default: "app") Predefined certificate stores: app: Application certificate store platform: System certificate store null: Empty certificate store If this value is defined, it forces authenticate to true and requires content to be signed regardless of the protocol used to deliver it. |

See [Repository Configuration](https://docs.directgvr.com/reference/storage-repository-system/repository-configuration.md) documentation for additional information.

**Changes:**

* 5.2 - Added store argument

**Example:**

```json theme={null}
syncIfNeeded:
  type: repositoryCheck
  repository: gameClient
  metafile: "{pathJoin:{moduleDirectory},Download,gameclient-meta.json}"
  update: updateGame
  install: installGame
  upToDate: syncComplete
```

### repositoryErase

Erase an existing repository.

**Version:**  5.1

**Arguments:**

See [Repository Configuration](https://docs.directgvr.com/reference/storage-repository-system/repository-configuration.md) documentation for additional information.

**Example:**

```json theme={null}
erase:
  type: repositoryErase
  repository: gameclient
  metafile: "{pathJoin:{moduleDirectory},Download,gameclient-meta.json}"
  local:
    type: file
    path: "{pathJoin:{moduleDirectory},Download}"
  backup:
    type: filePiece
    path: "{pathJoin:{moduleDirectory},Download,Backup}"
```

### 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:**

| **Name** | **Type** | **Description** | **Default** |
| - | - | - | - |
| **metafile** | string | Path to the repository metafile. | |
| **path** | string | Path to the local files on disk. | |
| timestamp | boolean | Compare modified time stamps. | true |
| authenticate | boolean | Authenticates the signature in JSON content. By default, it will authenticate the JSON on an HTTP connection and will not authenticate the JSON on a HTTPS connection because it is already secure. It will not try to authenticate a connection to the local \{contentUrl} webserver. | true |
| valid | string | Task to run if all files on disk match. | |
| notValid | string | Task to run if files on disk do not match. | |

**Errors:**

| **Name** | **Description** |
| - | - |
| RepositoryFileCheck\_Error\_MetaFile | Failed to open or read metafile. |

**Example:**

```json theme={null}
repairIfNeeded:
  type: repositoryFileCheck
  metafile: "{pathJoin:{moduleDirectory},Download,gameclient-meta.json}"
  path: "{repositoryDirectory}"
  valid: syncComplete
  notValid: repairGame
```

### repositorySync

Updates an existing repository.

**Version:**  5.1

**Arguments:**

| **Name** | **Type** | **Description** | **Default** |
| - | - | - | - |
| allowPartial | boolean | Allows cancelling before sync is complete. | true |
| pieceMove | boolean | Detect moved pieces and copy instead of redownloading (requires pending) | true |
| repair | boolean | Repair the repository.1 | |
| store | string/array | Certificate store used to authenticate (default: "app") Predefined certificate stores: app: Application certificate store platform: System certificate store null: Empty certificate store | |
| \* | | Additional repository arguments | |

See [Repository Configuration](https://docs.directgvr.com/reference/storage-repository-system/repository-configuration.md) 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:**

```json theme={null}
sync:
  type: repositorySync
  repository: gameclient
  metafile: "{pathJoin:{moduleDirectory},Download,gameclient-meta.json}"
  local:
    type: file
    path: "{pathJoin:{moduleDirectory},Download}"
  backup:
    type: filePiece
    path: "{pathJoin:{moduleDirectory},Download,Backup}"
  status: UI_Updating
  success: syncComplete
repair:
  type: repositorySync
  repository: gameclient
  metafile: "{pathJoin:{moduleDirectory},Download,gameclient-meta.json}"
  local:
    type: file
    path: "{pathJoin:{moduleDirectory},Download}"
  backup:
    type: filePiece
    path: "{pathJoin:{moduleDirectory},Download,Backup}"
  repair: true
  status: UI_Repairing
  success: syncComplete
```

### restorePoint

Sets a restore point.

**Version:**  5.1.8 (previously known as "restorePointBegin")

**Supported OS:**

* Windows (elevation required, not supported on UWP)

**Arguments:**

| **Name** | **Type** | **Description** | **Default** |
| - | - | - | - |
| **name** | string | Name of the restore point, usually the name of the app being installed. | |
| **actions** 1 | array of strings | List of task names to be executed. | |
| operation | string | The operation occurring that requires a restore point. install uninstall | install |
| nested | boolean | Use nested restore point. | false |

**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:**

| **Name** | **Description** |
| - | - |
| RestorePoint\_Error\_Set | Failed to set system restore point. |

**Example:**

```json theme={null}
setRestorePoint-win:
  type: restorePoint
  status: UI_CreatingRestorePoint
  operation: install
  name: "{productName}"
  actions:
    - task1
    - task2
```

### shortcutCreate

Creates a shortcut.

**Version:**  5.1

**Supported OS:**

* Windows (not supported on UWP)
* Linux

**Arguments:**

| **Name** | **Type** | **Description** | **Default** |
| - | - | - | - |
| **name** | string | Display name of the shortcut. (ie. "Game Map Editor") | |
| **path** | string | Path to the application that the shortcut will run. | |
| arguments | string/array | Arguments for the application. If the value is an array of strings, they are encapsulated by double quotes and combined. (Windows only) | |
| location | string | Directory to create the shortcut in. | \{userDesktop} |
| iconLocation | string | Path to the application/library that contains the icon. (Windows only) If no icon location is specified, the path to the application will be used. | |
| iconIndex | number | Index of the icon. (Windows only) If no icon index is specified, the first icon in the application executable is used. | |
| runAsAdmin | boolean | Runs the application as an administrator. (Windows only) | |

**Errors:**

| **Name** | **Description** |
| - | - |
| Shortcut\_Error\_Create | Failed to create shortcut. |

**Example:**

```json theme={null}
createDesktopShortcut:
  type: shortcutCreate
  name: MyApp
  path: "{pathJoin:{programFiles},MyApp2,myapp2.exe}"
```

### shortcutDelete

Deletes a shortcut.

**Version:**  5.1

**Supported OS:**

* Windows (not supported on UWP)
* Linux

**Arguments:**

| **Name** | **Type** | **Description** | |
| - | - | - | - |
| **name** | string | Display name of the shortcut. (ie. "Game Map Editor") | |
| location | string | Directory the shortcut is located in. | \{userDesktop} |

**Errors:**

| **Name** | **Description** |
| - | - |
| Shortcut\_Error\_Delete | Failed to delete shortcut. |

**Example:**

```json theme={null}
deleteDesktopShortcut:
  type: shortcutDelete
  name: MyApp
```

### shutdown

Stops further tasks from being run.

**Version:**  5.1

**Arguments:**

| **Name** | **Type** | **Description** | **Default** |
| - | - | - | - |
| exitCode | integer | Exit code to return from the program. | |
| force | boolean | Will not wait for tasks to finish before attempting to shutdown; any running tasks will be cancelled. Any tasks that are pending to be run will not be run except for the unload task and its children. | false |
| removeLocalStorage | boolean | Removes the local storage directory when the application closes. | false |
| restartElevated | boolean | Restarts the application with elevated privileges. | false |
| restart | boolean | Restarts the application. | false |

**Example:**

```json theme={null}
exit:
  type: shutdown
```

### singleton

Prevents launching concurrent tasks across multiple workflows.

**Version:**  6.1

**Supported OS:**

* Windows (not supported on UWP)
* macOS
* Linux

**Arguments:**

| **Name** | **Type** | **Description** |
| - | - | - |
| **name** | string | Name of singleton. |
| exists | string | Task to run when singleton exists. |
| missing | string | Task to run when singleton does not exist. |

**Example:**

```json theme={null}
installVCRuntimeIfNotInstalling:
  type: singleton
  name: vc2015runtime
  exists: skipVCRuntime
  missing: installVCRuntime
```

### skinFileExtract

Extracts a file from the skin to disk.

**Version:**  6.1

**Supported:**

* Only available in the DirectGVR Client (host).

**Arguments:**

| **Name** | **Type** | **Description** |
| - | - | - |
| **path** | string | Path in the skin bundle. |
| **outputPath** | string | Path to save the file on disk. |

**Example:**

```json theme={null}
extractBatchFile:
  type: skinFileExtract
  path: myCommands.bat
  outputPath: "{temp}"
```

### sleep

Waits for a specified amount of time.

**Version:**  5.1

**Arguments:**

| **Name** | **Type** | **Description** |
| - | - | - |
| **seconds** | string | Number of seconds to wait. |

**Example:**

```json theme={null}
waitForTenSeconds:
  type: sleep
  seconds: 10
```

### status

Updates the status for a specific object in the workflow.

**Version:**  5.1

**Arguments:**

| **Name** | **Type** | **Description** |
| - | - | - |
| **target** | string | Workflow or task to target for the status update. |
| \* | string | Status JSON to update. |

**Example:**

```json theme={null}
updateParentTaskStatus:
  type: status
  target: "{this.parent}"
  message: Child task complete.
```

### stringCompare

Compare two strings.

**Version:**  5.1

**Arguments:**

| **Name** | **Type** | **Description** | **Default** |
| - | - | - | - |
| **stringOne** | string | First string in comparison. | |
| **stringTwo** | string | Second string in comparison. | |
| ignoreCase | boolean | Ignore case when comparing strings. | false |
| equalTo | string | Task to run when strings match. | |
| notEqualTo | string | Task to run when strings do not match, case regardless. | |
| greaterThan | string | Task to run when first string is greater than second string. | |
| lessThan | string | Task to run when first string is less than second string. | |

**Example:**

```json theme={null}
isUserAdministrator:
  type: stringCompare
  stringOne: "{userName}"
  stringTwo: Administrator
  equalTo: installAsAdminUser
  notEqualTo: installAsPlebian
```

### stringContains

Check if one string contains another.

**Version:**  5.1

**Arguments:**

| **Name** | **Type** | **Description** | **Default** |
| - | - | - | - |
| **stringOne** | string | String to search through. | |
| **stringTwo** | string | String to find. | |
| ignoreCase | boolean | Ignore case when comparing strings. | false |
| found | string | Task to run when string is found. | |
| notFound | string | Task to run when string is not found. | |

**Example:**

```json theme={null}
isProcessorIntel:
  type: stringContains
  stringOne: "{CPUVendor}"
  stringTwo: Intel
  found: usingIntelProcessor
  notFound: notUsingIntelProcessor
```

### unzip

Extracts a zip archive to disk.

**Version:**  5.1

**Arguments:**

| **Name** | **Type** | **Description** | **Default** |
| - | - | - | - |
| **path** | string | Path to the zip file. | |
| **pathInZip** | string | Name of the entry in the zip file to extract. Supports wildcards. | \* |
| **outputDirectory** | string | Path to the directory to extract the zip file to. | |
| password | string | Password to use when extracting the zip file. | |

**Status Variables:**

| **Name** | **Type** | **Description** |
| - | - | - |
| pathInZip | string | Path of the file being extracted in the zip. |
| outputPath | string | Path of the file being extracted on disk. |
| localReadSpeed | number | Number of compressed bytes read from the zip file per second. |
| localWriteSpeed | number | Number of decompressed bytes per second. |

**Changes:**

* 5.2 - Added password argument for encrypted archives
* 5.2 - Added support for AES encrypted archives

**Example:**

```json theme={null}
unzipDownload:
  type: unzip
  path: "{this.parent.status.OutputPath}"
  pathInZip: "*"
  outputDirectory: "{userDesktop}"
```

### 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:**

| **Name** | **Type** | **Description** |
| - | - | - |
| **beginsWith** | string/array of strings | Checks if the URL begins with this string before redirecting. |
| **append** 1 | string | Appends value to the existing URL. |
| **replace** 1 | string | Replaces the existing URL. |

**Additional Notes:**

1. *beginsWith* /*append*  or *beginsWith* /*replace*  arguments are required (not all).

**Example:**

```json theme={null}
urlRedirectAppend:
  type: urlRedirect
  beginsWith: http://localhost/
  append: "?e={Add:{Time60},600}"
urlRedirectReplace:
  type: urlRedirect
  beginsWith: http://localhost/index.html
  replace: http://localhost/default.html
```

### 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:**

| **Name** | **Type** | **Description** |
| - | - | - |
| **key** 1 | string | Macro name. |
| **value** 1 | string/integer | Macro value. |
| **keyValuePairs** 1 | string | Macro key/value pairs. |

**Additional Notes:**

1. *key/value* or*keyValuePairs* arguments are required (not all)

**Example:**

```json theme={null}
urlRedirectMacro:
  type: urlRedirectMacro
  key: TokenAuthPrivateKey
  value: MyPrivateKey
  complete: urlRedirectAppend
urlRedirectAppend:
  type: urlRedirect
  beginsWith: http://localhost/
  append: "?e={Add:{Time60},600}{Copy:&t={MD5:{ThisUrlPath}&s={TokenAuthPrivateKey}}}"
```

### 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:**

| **Name** | **Type** | **Description** |
| - | - | - |
| **versionOne** | string | First version in comparison. |
| **versionTwo** | string | Second version in comparison. |
| equalTo | string | Task to run when versions match. |
| notEqualTo | string | Task to run when versions do not match. |
| greaterThan | string | Task to run when first version is greater than second version. |
| lessThan | string | Task to run when first version is less than second version. |

**Example:**

```json theme={null}
compareVersions:
  type: versionCompare
  versionOne: "{commandLine:installVersion}"
  versionTwo: 2.3.0.1
  equalTo: installed
  notEqualTo: notInstalled
```

### wmi

Queries the Windows Management Instrumentation service.

**Version:**  5.1.3

**Supported OS:**

* Windows (not supported on UWP)

**Arguments:**

| **Name** | **Type** | **Description** | **Default** |
| - | - | - | - |
| **query** | string | WQL query. | |
| **key** 1 | string | Name of the property to retrieve. | |
| **keys** 1 | string/array | Names of the properties to retrieve. | |
| server | string | Name of the server. | root\cimv2 |
| matched | string | Task to run if matches were found for the requested query. | |
| notMatched | string | Task to run if no matches were found for the requested query. | |

**Additional Notes:**

1. *key*  or *keys*  arguments are required (not both)

**Errors:**

| **Name** | **Description** |
| - | - |
| Wmi\_Error\_Create | Failed to create wmi object. |

**Example:**

```json theme={null}
getMemoryInfo:
  type: wmi
  query: SELECT * FROM Win32_PhysicalMemory
  key: DeviceLocator
  complete: logMemoryInfo
logMemoryInfo:
  type: log
  message: "{this.parent.status.Items[0].DeviceLocator}"
getProcessorInfo:
  type: wmi
  query: SELECT * FROM Win32_Processor
  keys:
    - Family
    - Architecture
  complete: logProcessorInfo
logProcessorInfo:
  type: log
  message: "Arch: {this.parent.status.Items[0].Architecture} Fam: {this.parent.status.Items[0].Family}"
```

### workflowRun

Runs a separate workflow\.1

**Version:**  5.1

**Arguments:**

| **Name** | **Type** | **Description** | **Default** |
| - | - | - | - |
| **url** | string | URL/file of the workflow to run. | |
| elevated | boolean | Run with elevated permissions. If the workflow does not need to be elevated, it will be run in the current process. If the workflow does need to be elevated and the current process is not elevated, it will spawn a new elevated instance and run the workflow in that process. *Not supported in UWP.* | false |
| start | string | Task to run after *load* task has completed. This allows you to use the same workflow for both the elevated and unelevated processes. | start |
| store | string/array | Certificate store used to authenticate (default: "app") Predefined certificate stores: app: Application certificate store platform: System certificate store null: Empty certificate store If this value is defined, it forces authenticate to true and requires content to be signed regardless of the protocol used to deliver it. | |
| load | string | Task to run after loading the workflow. This allows you to use the same workflow for both the elevated and unelevated processes. | load |
| unload | string | Task to run before unloading the workflow. This allows you to use the same workflow for both the elevated and unelevated processes. | unload |
| arguments | string/array | Arguments to send to the workflow, if it needs to be elevated. If the value is an array of strings, they are encapsulated by double quotes and combined. | |
| authenticate | boolean | Authenticates the signature in JSON content. By default, it will authenticate the JSON on an HTTP connection and will not authenticate the JSON on a HTTPS connection because it is already secure. It will not try to authenticate a connection to the local \{contentUrl} webserver. | true |

**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:**

| **Name** | **Type** | **Description** |
| - | - | - |
| path | string | Path of the worker application that was launched. |
| arguments | string | Arguments used to launch the worker application. |

**Errors:**

| **Name** | **Description** |
| - | - |
| Launch\_Error\_Run | Error occurred while launching process. |
| WorkflowRun\_Error\_Request | The url request has failed. |
| WorkflowRun\_Error\_Parse | Failed to parse workflow file. |
| WorkflowRun\_Error\_Open | Failed to open workflow file. |
| WorkflowRun\_Error\_Authenticate | Failed to authenticate workflow JSON. |

**Example:**

```json theme={null}
runElevatedWorkflow:
  type: workflowRun
  url: "{pathToUrl:{WorkflowDirectory}elevated.json}"
  elevated: true
  arguments: "--verbose=25Web* --disablesecurity"
```

**Example using another task in the same workflow:**

```json theme={null}
runElevatedWorkflow:
  type: workflowRun
  url: "{contentUrl}workflow.yaml"
  start: alternativeStartTask
  elevated: true
```

### xmlRead

Reads values from an xml file.

**Version:**  5.1

**Arguments:**

| **Name** | **Type** | **Description** |
| - | - | - |
| **path** 1 | string | Path to the xml file to read from. |
| **url** 1 | string | URL to the xml file to read from. |
| **key** 2 | string | Key to read. |
| **keys** 2 | array of strings | Keys to read. |
| read | string | Task to run when all keys were read successfully. |
| notRead | string | Task to run when one or more keys were not read. |

**Additional Notes:**

1. *path*  or *url*  arguments are required (not both)
2. *key* /*value*  or *keys* arguments are required (not both)

**Status Variables:**

| **Name** | **Type** | **Description** |
| - | - | - |
| \* | string | Values that were read. |

**Errors:**

| **Name** | **Description** |
| - | - |
| Xml\_Error\_Open | Failed to open xml file. |
| Xml\_Error\_Parse | Failed to parse xml content. |
| WebGet\_Error\_\* | WebGet errors. |
| Platform\_Error\_\* | Platform errors. |

**Changes:**

* 5.2 - Added url argument
* 5.2 - Added Xml\_Error\_Parse error

**Example:**

Xml:

```json theme={null}
<?xml version="1.0" ?>
<catalog>
   <book id="bk101">
      <author>Gambardella, Matthew</author>
      <title>XML Developer's Guide</title>
      <genre>Computer</genre>
      <price>44.95</price>
      <publish_date>2000-10-01</publish_date>
      <description>An in-depth look at creating applications 
      with XML.</description>
   </book>
</catalog>
```

Workflow:

```json theme={null}
readAttribute:
  type: xmlRead
  path: "{pathJoin:{userDesktop},test.xml}"
  key: catalog.book.-id
  complete: logAttribute
logAttribute:
  type: log
  message: "{this.parent.status.-id}"
readElement:
  type: xmlRead
  path: "{pathJoin:{userDesktop},test.xml}"
  key: catalog.book.author
  complete: logElement
logElement:
  type: log
  message: "{this.parent.status.author}"
```

### xmlWrite

Adds or edits values in a xml file.

**Version:**  5.1

**Arguments:**

| **Name** | **Type** | **Description** |
| - | - | - |
| **path** | string | Path to the xml file to write to. |
| **key** 1 | string | Key to write. |
| **value** 1 | string/integer | Value to write. |
| **keyValuePairs** 1 | key/value pairs | Block of key/value pairs to write. |

**Additional Notes:**

1. *key* /*value*  or *keyValuePairs*  arguments are required (not both)

**Errors:**

| **Name** | **Description** |
| - | - |
| Xml\_Error\_Open | Failed to open xml file. |
| Xml\_Error\_Write | Failed to write xml key. |
| Xml\_Error\_Save | Failed to save xml to file. |

**Example:**

Xml:

```json theme={null}
<?xml version="1.0" ?>
<catalog>
   <book id="bk101">
      <author>Gambardella, Matthew</author>
      <title>XML Developer's Guide</title>
      <genre>Computer</genre>
      <price>44.95</price>
      <publish_date>2000-10-01</publish_date>
      <description>An in-depth look at creating applications 
      with XML.</description>
   </book>
</catalog>
```

Workflow:

```json theme={null}
writeXmlAttribute:
  type: xmlWrite
  path: "{pathJoin:{userDesktop},test.xml}"
  key: catalog.book.-id
  value: bk100
writeXmlElement:
  type: xmlWrite
  path: "{pathJoin:{userDesktop},test.xml}"
  keyValuePairs:
    catalog.book.modifiedDate: 10/12/17
    catalog.book~.-id: bk103
    catalog.book[-id=bk103].author: Nate The Great
    catalog.book[-id=bk103].title: Superman
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.