> 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/da/powershell-kommandoer/new-psuworkflowactivity.md).

# New-PSUWorkflowActivity

New-PSUWorkflowActivity opbygger en definition af en arbejdsflowaktivitet i PowerShell Universal, der kan integreres i en scriptblok til en arbejdsflowdefinition.

## Synopsis

Opretter en definition af en arbejdsflowaktivitet.

## Syntaks

```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]`. Aktivitetsmetadata kan vise yderligere dynamiske parametre for den valgte `-Type`.

## Beskrivelse

Bygger en aktivitet til scriptblokken `-Definition` i `New-PSUWorkflow`. `-Parameters` angiver litterale aktivitetsegenskaber, og `-Expressions` angiver PowerShell-udtryk, der evalueres ved kørsel. Objektbeholderaktiviteter, herunder `Sequence` og `Parallel`, understøtter indlejrede aktiviteter. Cmdlet'en slår aktivitetsmetadata op for at validere typen og tilgængeliggøre dynamiske parametre; hvis opslag af dynamiske parametre mislykkes, skal De bruge `-Parameters` i stedet.

## Eksempel

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

## Parametre

| Parameter                     | Beskrivelse                                                                 |
| ----------------------------- | --------------------------------------------------------------------------- |
| `-Type`                       | Påkrævet registreret arbejdsflowaktivitetstype.                             |
| `-Id`                         | Aktivitetsidentifikator.                                                    |
| `-Name`                       | Aktivitetsnavn.                                                             |
| `-ScriptFullPath`             | Scriptsti til en scriptbaseret aktivitet.                                   |
| `-TrueContinueAfterDecision`  | Om true-forgreningen fortsætter efter en beslutning (standard `$true`).     |
| `-FalseContinueAfterDecision` | Om den falske gren fortsætter efter en beslutning (standard `$true`).       |
| `-Parameters`                 | Hashtable med bogstavelige værdier for aktivitetsegenskaber.                |
| `-Expressions`                | Hashtable med PowerShell-udtryk ved kørsel.                                 |
| `-ComputerName`               | URL eller værtsnavn for PSU-serveren til opslag af metadata (alias `-Uri`). |
| `-AppToken`                   | Administrations-API'ens app-token til opslag af metadata.                   |
| `-Credential`                 | Legitimationsoplysninger til Management API.                                |
| `-UseDefaultCredentials`      | Bruger de aktuelle Windows-legitimationsoplysninger.                        |
| `-Integrated`                 | Bruger den integrerede administrationsklient i processen.                   |
| `-TrustCertificate`           | Ignorerer fejl ved certifikatvalidering.                                    |
| `-Cookies`                    | Genbruger sessionscookies til godkendelse.                                  |

## Tilladelser

Adgangstokenet kræver `automation.workflows/read` for at køre denne cmdlet eksternt. Cmdlet'en læser aktivitetsmetadata for at opbygge en arbejdsflowdefinition; den opretter ikke et arbejdsflow på serveren.


---

# 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/da/powershell-kommandoer/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.
