> For the complete documentation index, see [llms.txt](https://docs.devolutions.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devolutions.net/powershell-universal/powershell-commands/new-psuworkflowactivity.md).

# New-PSUWorkflowActivity

New-PSUWorkflowActivity builds a workflow activity definition in PowerShell Universal that can be embedded in a workflow definition script block.

## SYNOPSIS

Creates a workflow activity definition.

## SYNTAX

```powershell
New-PSUWorkflowActivity -Type <String> [-Id <String>] [-Name <String>] [-ScriptFullPath <String>] [-TrueContinueAfterDecision <Boolean>] [-FalseContinueAfterDecision <Boolean>] [-Parameters <Hashtable>] [-Expressions <Hashtable>] [<ConnectionOptions>] [<CommonParameters>]
```

`<ConnectionOptions>`: `[-ComputerName <String>] [-AppToken <String>] [-Credential <PSCredential>] [-UseDefaultCredentials] [-Integrated] [-TrustCertificate] [-Cookies]`. Activity metadata can expose additional dynamic parameters for the chosen `-Type`.

## DESCRIPTION

Builds an activity for the `-Definition` script block of `New-PSUWorkflow`. `-Parameters` supplies literal activity properties and `-Expressions` supplies PowerShell expressions evaluated at runtime. Container activities, including `Sequence` and `Parallel`, support nested activities. The cmdlet looks up activity metadata to validate the type and expose dynamic parameters; if dynamic parameter lookup fails, use `-Parameters` instead.

## EXAMPLE

```powershell
New-PSUWorkflowActivity -Type Parallel -Activities {
    New-PSUWorkflowActivity -Type Script -ScriptFullPath 'C:\Repository\Test1.ps1'
    New-PSUWorkflowActivity -Type Script -ScriptFullPath 'C:\Repository\Test2.ps1'
}
```

## PARAMETERS

| Parameter                     | Description                                                            |
| ----------------------------- | ---------------------------------------------------------------------- |
| `-Type`                       | Required registered workflow activity type.                            |
| `-Id`                         | Activity identifier.                                                   |
| `-Name`                       | Activity name.                                                         |
| `-ScriptFullPath`             | Script path for a script-backed activity.                              |
| `-TrueContinueAfterDecision`  | Whether the true branch continues after a decision (default `$true`).  |
| `-FalseContinueAfterDecision` | Whether the false branch continues after a decision (default `$true`). |
| `-Parameters`                 | Hashtable of literal activity property values.                         |
| `-Expressions`                | Hashtable of runtime PowerShell expressions.                           |
| `-ComputerName`               | PSU server URL or host name for metadata lookup (alias `-Uri`).        |
| `-AppToken`                   | Management API app token for metadata lookup.                          |
| `-Credential`                 | Management API credentials.                                            |
| `-UseDefaultCredentials`      | Uses current Windows credentials.                                      |
| `-Integrated`                 | Uses the in-process management client.                                 |
| `-TrustCertificate`           | Ignores certificate validation errors.                                 |
| `-Cookies`                    | Reuses session authentication cookies.                                 |

## PERMISSIONS

The access token requires `automation.workflows/read` to run this cmdlet remotely. The cmdlet reads activity metadata to build a workflow definition; it does not create a workflow on the server.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.devolutions.net/powershell-universal/powershell-commands/new-psuworkflowactivity.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
