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

# Set-PSUTrigger

Set-PSUTrigger updates an existing automation trigger in PowerShell Universal, including its event type, script, dashboard, and environment.

## SYNOPSIS

Updates an existing automation trigger.

## SYNTAX

```powershell
Set-PSUTrigger -Id <Int64> [-Name <String>] [-EventType <EventType>] [-Script <String>] [-Scripts <String[]>] [-TriggerScript <String>] [-Environment <String>] [-Dashboard <String>] [-Parameters <Hashtable>] [<ConnectionOptions>] [<CommonParameters>]
Set-PSUTrigger -Trigger <Trigger> [-Name <String>] [-EventType <EventType>] [-Script <String>] [-Scripts <String[]>] [-TriggerScript <String>] [-Environment <String>] [-Dashboard <String>] [-Parameters <Hashtable>] [<ConnectionOptions>] [<CommonParameters>]
```

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

## DESCRIPTION

Updates a trigger by ID or pipeline object. Only supplied fields change. `-Scripts` replaces its script selection and supports multiple scripts; `-Script` selects a single script instead. `-Parameters` passes a hashtable to the trigger script when it fires and resolves that script's declared parameters. A blank `-Name` is rejected.

## EXAMPLES

```powershell
Set-PSUTrigger -Id 4 -Name 'Server Startup' -EventType ServerStarted
Set-PSUTrigger -Id 4 -Scripts 'Build.ps1','Deploy.ps1' -Parameters @{ Channel = 'ops' }
```

## PARAMETERS

| Parameter                | Description                                                                 |
| ------------------------ | --------------------------------------------------------------------------- |
| `-Id`                    | Numeric trigger ID.                                                         |
| `-Trigger`               | Trigger object; accepts pipeline input.                                     |
| `-Name`                  | New nonempty trigger name.                                                  |
| `-EventType`             | Event type activating the trigger.                                          |
| `-Script`                | Selects one associated script and clears the multi-script selection.        |
| `-Scripts`               | Selects multiple associated scripts and clears the single-script selection. |
| `-TriggerScript`         | Path of the script executed when the event fires.                           |
| `-Environment`           | Execution environment.                                                      |
| `-Dashboard`             | Associated app name.                                                        |
| `-Parameters`            | Hashtable of parameters for the trigger script.                             |
| `-ComputerName`          | Target PSU server URL or host name (alias `-Uri`).                          |
| `-AppToken`              | Management API app token.                                                   |
| `-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.                                      |

## INPUTS

`UniversalAutomation.Trigger`.

## PERMISSIONS

The access token requires `automation.triggers/update` to run this cmdlet remotely.


---

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