> 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-psutrigger.md).

# New-PSUTrigger

New-PSUTrigger opretter en automatiseringsudløser i PowerShell Universal, der kører et script som reaktion på hændelser som jobfejl eller dashboardstop.

## Synopsis

Opretter en automatiseringsudløser.

## Syntaks

```powershell
New-PSUTrigger -Name <String> -EventType <EventType> -TriggerScript <Script> [-Script <Script>] [-Scripts <Script[]>] [-Dashboard <Dashboard>] [-Environment <String>] [-Delay <Int32>] [-Computer <String>] [-Condition <ScriptBlock>] [-Parameters <Hashtable>] [<ConnectionOptions>] [<CommonParameters>]
```

`<ConnectionOptions>`: `[-ComputerName <String>] [-AppToken <String>] [-Credential <PSCredential>] [-UseDefaultCredentials] [-Integrated] [-TrustCertificate] [-Cookies]`.

## Beskrivelse

Opretter en udløser, der kører et udløserscript for PSU-hændelser. Brug `-Script` eller `-Scripts` til at knytte et eller flere scripts til udløsere for jobhændelser; hvis begge er angivet, har `-Scripts` forrang. `-Parameters` leverer en hashtable til udløserscriptet og opløser dets erklærede parametre. Filtrér eventuelt kørslen med `-Condition`.

## Eksempel

```powershell
New-PSUTrigger -Name 'Build failures' -EventType JobFailed -Scripts 'Build.ps1','Deploy.ps1' -TriggerScript 'Notify.ps1' -Parameters @{ Channel = 'ops' }
```

## Parametre

| Parameter                | Beskrivelse                                                            |
| ------------------------ | ---------------------------------------------------------------------- |
| `-Name`                  | Påkrævet udløsernavn.                                                  |
| `-EventType`             | Påkrævet PSU-hændelsestype, der aktiverer udløseren.                   |
| `-TriggerScript`         | Påkrævet script, der køres, når hændelsen indtræffer.                  |
| `-Script`                | Ét tilknyttet script til filtrering af hændelser.                      |
| `-Scripts`               | Flere tilknyttede scripts til filtrering af hændelser.                 |
| `-Dashboard`             | App knyttet til hændelsen.                                             |
| `-Environment`           | Kørselsmiljø for udløserscriptet.                                      |
| `-Delay`                 | Forsinkelse før kørsel af udløseren.                                   |
| `-Computer`              | Udførelsescomputer eller -gruppe.                                      |
| `-Condition`             | Scriptblokbetingelse, der skal være opfyldt.                           |
| `-Parameters`            | Parameterværdier for udløserscriptet.                                  |
| `-ComputerName`          | URL eller værtsnavn for mål-PSU-administrations-API'en (alias `-Uri`). |
| `-AppToken`              | App-token til Management API.                                          |
| `-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.triggers/create` for at køre denne cmdlet eksternt.


---

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