# Create Scheduled Task

> Creates a scheduled task on the computer.

Source: https://docs.capaone.com/capaone/application-manager/powerbricks/bricks/create-scheduled-task/  
Product: CapaOne — a separate CapaSystems product; do not apply this page to any other.

Creates a scheduled task on the computer. The task can either be built from the settings on this brick or created from a task definition file exported from Task Scheduler, which is the easiest way to create a complex task.\\n\\nAn existing task with the same name in the same folder is only replaced when Overwrite is enabled, so a duplicate task is never created by accident.\\n\\nAdd the [Download Content] PowerBrick when the task definition file is delivered with the package.

## Parameters

#### Task Definition Source
*Required* — Default: `Build From Settings`

Choose how the scheduled task is defined.\\n\\nBuild From Settings: The task is created from the trigger, program and account settings on this brick.\\n\\nImport From File: The task is created from a task definition file exported from Task Scheduler. Use this for tasks that need more than one trigger or action, or any setting that is not available on this brick.\\n\\nThe settings that do not belong to the selected source are ignored. Allowed values: `Build From Settings`, `Import From File`.

#### Task Name
*Required*

The name the task gets in Task Scheduler. This name is also used to check whether the task already exists.\\n\\nExample: Nightly Cleanup\\n\\nThe characters \\ / : * ? " \< > | cannot be used in a task name.

#### Task Folder
*Optional* — Default: `\`

The folder in the Task Scheduler library where the task is placed. The folder is created if it does not exist.\\n\\nExample: \\CapaOne\\n\\nLeave the value as \\ to place the task in the top level of the library.

#### Task Definition File
*Optional*

The full path to a task definition file exported from Task Scheduler. Only used when the source is Import From File, and required in that case.\\n\\nExample: $PackageRoot\\NightlyCleanup.xml\\n\\nRemember the [Download Content] PowerBrick when the file is delivered with the package. The brick fails if the file is missing or is not a valid task definition.

#### Trigger
*Optional* — Default: `Daily`

Decides when the task runs. Only used when the source is Build From Settings.\\n\\nAt Logon: Every time a user logs on.\\nAt Startup: Every time the computer starts.\\nDaily: Every day at the start time.\\nOnce: A single time at the start time.\\n\\nDaily and Once also require a start time. Allowed values: `At Logon`, `At Startup`, `Daily`, `Once`.

#### Start Time
*Optional* — Default: `01:00`

The time the task starts. Required for the Daily and Once triggers, and ignored for the other triggers.\\n\\nExample: 08:00\\nExample: 2026-01-31 08:00\\n\\nThe field starts at 01:00, which suits the daily trigger it is paired with: the machine is normally on, nobody is working, and a task that takes a while disturbs no one. Change it if the work has to happen at a particular time of day.\\n\\nWhen only a time is given for the Once trigger and that time has already passed today, the task is scheduled for the next day.

#### Program To Run
*Optional*

The full path to the program or script the task runs. Only used when the source is Build From Settings, and required in that case.\\n\\nExample: C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\\n\\nThe program must already be on the device and stay there, because the task runs later - possibly days later. Do not point this at the package folder: that folder belongs to this installation only. Copy the file to a permanent folder first, for example with the [Copy File] PowerBrick, and point the task at the copy.

#### Arguments
*Optional*

The command line arguments given to the program. Leave empty when the program does not need any.\\n\\nExample: -ExecutionPolicy Bypass -File "C:\\Scripts\\Cleanup.ps1"\\n\\nA script named here has to follow the same rule as the program itself: it must be in a permanent folder, not in the package folder, because the task runs long after this installation has finished.

#### Working Directory
*Optional*

The folder the program is started in. Leave empty to let Windows decide. Some programs fail when they are started from the wrong folder.\\n\\nExample: C:\\Scripts

#### Run As Account
*Optional* — Default: `SYSTEM`

The account the task runs as.\\n\\nSYSTEM: Runs in the background with full rights on the computer and without a user interface.\\nUsers: Runs for any user that is logged on, with that user's rights.\\nCustom Account: Runs as the account given below, which also requires a password.\\n\\nWhen the source is Import From File the account from the file is used, unless Custom Account is selected here. Allowed values: `SYSTEM`, `Users`, `Custom Account`.

#### Account Name
*Optional*

The account the task runs as when Custom Account is selected. Required in that case, and ignored otherwise.\\n\\nExample: CONTOSO\\svc-cleanup\\nExample: .\\LocalServiceUser

#### Account Password
*Optional*

The password for the account above. Required when Custom Account is selected, and ignored otherwise.\\n\\nThe password is never written to the job log. The task keeps the password so it can run when nobody is logged on, so remember to update the task if the password is changed later.

#### Run With Highest Privileges
*Optional* — Default: `True`

Enable to run the task with the highest rights the account has, which is needed for tasks that change the system. Disable to run the task with normal rights. The setting is ignored when the task is created from a task definition file, because the file decides it.

#### Overwrite Existing Task
*Optional* — Default: `False`

Enable to replace a task that already exists with the same name in the same folder. Disable to stop with an error instead, so an existing task is never changed by accident.

## Details

- **Category:** System
- **Brick ID:** `ScheduledTask-Create`

## Raw JSON definition

```json
{
  "category": "system",
  "description": "Creates a scheduled task on the computer. The task can either be built from the settings on this brick or created from a task definition file exported from Task Scheduler, which is the easiest way to create a complex task.\\n\\nAn existing task with the same name in the same folder is only replaced when Overwrite is enabled, so a duplicate task is never created by accident.\\n\\nAdd the [Download Content] PowerBrick when the task definition file is delivered with the package.",
  "developerVendor": "CapaSystems A/S",
  "displayName": null,
  "id": "ScheduledTask-Create",
  "name": "Create Scheduled Task",
  "parameters": [
    {
      "allowManualInput": false,
      "defaultValue": null,
      "defaultValueObject": {
        "id": "Parameters",
        "name": "Build From Settings"
      },
      "description": "Choose how the scheduled task is defined.\\n\\nBuild From Settings: The task is created from the trigger, program and account settings on this brick.\\n\\nImport From File: The task is created from a task definition file exported from Task Scheduler. Use this for tasks that need more than one trigger or action, or any setting that is not available on this brick.\\n\\nThe settings that do not belong to the selected source are ignored.",
      "id": "Source",
      "name": "Task Definition Source",
      "regExValidation": "",
      "required": true,
      "type": "ComboBox",
      "value": null,
      "values": [],
      "valuesObject": [
        {
          "id": "Parameters",
          "name": "Build From Settings"
        },
        {
          "id": "XmlFile",
          "name": "Import From File"
        }
      ]
    },
    {
      "allowManualInput": false,
      "defaultValue": "",
      "defaultValueObject": null,
      "description": "The name the task gets in Task Scheduler. This name is also used to check whether the task already exists.\\n\\nExample: Nightly Cleanup\\n\\nThe characters \\ / : * ? \" < > | cannot be used in a task name.",
      "id": "TaskName",
      "name": "Task Name",
      "regExValidation": "^[^\\\\/:*?\"<>|]+$",
      "required": true,
      "type": "TextBox",
      "value": null,
      "values": [],
      "valuesObject": null
    },
    {
      "allowManualInput": false,
      "defaultValue": "\\",
      "defaultValueObject": null,
      "description": "The folder in the Task Scheduler library where the task is placed. The folder is created if it does not exist.\\n\\nExample: \\CapaOne\\n\\nLeave the value as \\ to place the task in the top level of the library.",
      "id": "TaskPath",
      "name": "Task Folder",
      "regExValidation": "",
      "required": false,
      "type": "TextBox",
      "value": null,
      "values": [],
      "valuesObject": null
    },
    {
      "allowManualInput": false,
      "defaultValue": "",
      "defaultValueObject": null,
      "description": "The full path to a task definition file exported from Task Scheduler. Only used when the source is Import From File, and required in that case.\\n\\nExample: $PackageRoot\\NightlyCleanup.xml\\n\\nRemember the [Download Content] PowerBrick when the file is delivered with the package. The brick fails if the file is missing or is not a valid task definition.",
      "id": "XmlFilePath",
      "name": "Task Definition File",
      "regExValidation": "",
      "required": false,
      "type": "TextBox",
      "value": null,
      "values": [],
      "valuesObject": null
    },
    {
      "allowManualInput": false,
      "defaultValue": null,
      "defaultValueObject": {
        "id": "Daily",
        "name": "Daily"
      },
      "description": "Decides when the task runs. Only used when the source is Build From Settings.\\n\\nAt Logon: Every time a user logs on.\\nAt Startup: Every time the computer starts.\\nDaily: Every day at the start time.\\nOnce: A single time at the start time.\\n\\nDaily and Once also require a start time.",
      "id": "Trigger",
      "name": "Trigger",
      "regExValidation": "",
      "required": false,
      "type": "ComboBox",
      "value": null,
      "values": [],
      "valuesObject": [
        {
          "id": "AtLogon",
          "name": "At Logon"
        },
        {
          "id": "AtStartup",
          "name": "At Startup"
        },
        {
          "id": "Daily",
          "name": "Daily"
        },
        {
          "id": "Once",
          "name": "Once"
        }
      ]
    },
    {
      "allowManualInput": false,
      "defaultValue": "01:00",
      "defaultValueObject": null,
      "description": "The time the task starts. Required for the Daily and Once triggers, and ignored for the other triggers.\\n\\nExample: 08:00\\nExample: 2026-01-31 08:00\\n\\nThe field starts at 01:00, which suits the daily trigger it is paired with: the machine is normally on, nobody is working, and a task that takes a while disturbs no one. Change it if the work has to happen at a particular time of day.\\n\\nWhen only a time is given for the Once trigger and that time has already passed today, the task is scheduled for the next day.",
      "id": "StartTime",
      "name": "Start Time",
      "regExValidation": "",
      "required": false,
      "type": "TextBox",
      "value": null,
      "values": [],
      "valuesObject": null
    },
    {
      "allowManualInput": false,
      "defaultValue": "",
      "defaultValueObject": null,
      "description": "The full path to the program or script the task runs. Only used when the source is Build From Settings, and required in that case.\\n\\nExample: C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\\n\\nThe program must already be on the device and stay there, because the task runs later - possibly days later. Do not point this at the package folder: that folder belongs to this installation only. Copy the file to a permanent folder first, for example with the [Copy File] PowerBrick, and point the task at the copy.",
      "id": "ExecutePath",
      "name": "Program To Run",
      "regExValidation": "",
      "required": false,
      "type": "TextBox",
      "value": null,
      "values": [],
      "valuesObject": null
    },
    {
      "allowManualInput": false,
      "defaultValue": "",
      "defaultValueObject": null,
      "description": "The command line arguments given to the program. Leave empty when the program does not need any.\\n\\nExample: -ExecutionPolicy Bypass -File \"C:\\Scripts\\Cleanup.ps1\"\\n\\nA script named here has to follow the same rule as the program itself: it must be in a permanent folder, not in the package folder, because the task runs long after this installation has finished.",
      "id": "Arguments",
      "name": "Arguments",
      "regExValidation": "",
      "required": false,
      "type": "TextBox",
      "value": null,
      "values": [],
      "valuesObject": null
    },
    {
      "allowManualInput": false,
      "defaultValue": "",
      "defaultValueObject": null,
      "description": "The folder the program is started in. Leave empty to let Windows decide. Some programs fail when they are started from the wrong folder.\\n\\nExample: C:\\Scripts",
      "id": "WorkingDirectory",
      "name": "Working Directory",
      "regExValidation": "",
      "required": false,
      "type": "TextBox",
      "value": null,
      "values": [],
      "valuesObject": null
    },
    {
      "allowManualInput": false,
      "defaultValue": null,
      "defaultValueObject": {
        "id": "SYSTEM",
        "name": "SYSTEM"
      },
      "description": "The account the task runs as.\\n\\nSYSTEM: Runs in the background with full rights on the computer and without a user interface.\\nUsers: Runs for any user that is logged on, with that user's rights.\\nCustom Account: Runs as the account given below, which also requires a password.\\n\\nWhen the source is Import From File the account from the file is used, unless Custom Account is selected here.",
      "id": "RunAsAccount",
      "name": "Run As Account",
      "regExValidation": "",
      "required": false,
      "type": "ComboBox",
      "value": null,
      "values": [],
      "valuesObject": [
        {
          "id": "SYSTEM",
          "name": "SYSTEM"
        },
        {
          "id": "Users",
          "name": "Users"
        },
        {
          "id": "Custom",
          "name": "Custom Account"
        }
      ]
    },
    {
      "allowManualInput": false,
      "defaultValue": "",
      "defaultValueObject": null,
      "description": "The account the task runs as when Custom Account is selected. Required in that case, and ignored otherwise.\\n\\nExample: CONTOSO\\svc-cleanup\\nExample: .\\LocalServiceUser",
      "id": "AccountName",
      "name": "Account Name",
      "regExValidation": "",
      "required": false,
      "type": "TextBox",
      "value": null,
      "values": [],
      "valuesObject": null
    },
    {
      "allowManualInput": false,
      "defaultValue": "",
      "defaultValueObject": null,
      "description": "The password for the account above. Required when Custom Account is selected, and ignored otherwise.\\n\\nThe password is never written to the job log. The task keeps the password so it can run when nobody is logged on, so remember to update the task if the password is changed later.",
      "id": "Base64Password",
      "name": "Account Password",
      "regExValidation": "",
      "required": false,
      "type": "TextBoxWithPassword",
      "value": null,
      "values": [],
      "valuesObject": null
    },
    {
      "allowManualInput": false,
      "defaultValue": "True",
      "defaultValueObject": null,
      "description": "Enable to run the task with the highest rights the account has, which is needed for tasks that change the system. Disable to run the task with normal rights. The setting is ignored when the task is created from a task definition file, because the file decides it.",
      "id": "RunWithHighestPrivileges",
      "name": "Run With Highest Privileges",
      "regExValidation": "",
      "required": false,
      "type": "Boolean",
      "value": null,
      "values": [],
      "valuesObject": null
    },
    {
      "allowManualInput": false,
      "defaultValue": "False",
      "defaultValueObject": null,
      "description": "Enable to replace a task that already exists with the same name in the same folder. Disable to stop with an error instead, so an existing task is never changed by accident.",
      "id": "Overwrite",
      "name": "Overwrite Existing Task",
      "regExValidation": "",
      "required": false,
      "type": "Boolean",
      "value": null,
      "values": [],
      "valuesObject": null
    }
  ],
  "powershell": {
    "base64Encoded": true,
    "function": "ZnVuY3Rpb2..."
  },
  "type": "powerbrick",
  "version": "2026.10.8.1"
}
```
