New-PSUTrigger
SYNOPSIS
Creates an automation trigger.
SYNTAX
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].
DESCRIPTION
Creates a trigger that runs a trigger script for PSU events. Use -Script or -Scripts to associate one or more scripts with job-event triggers; if both are supplied, -Scripts takes precedence. -Parameters supplies a hashtable to the trigger script and resolves its declared parameters. Optionally filter execution with -Condition.
EXAMPLE
New-PSUTrigger -Name 'Build failures' -EventType JobFailed -Scripts 'Build.ps1','Deploy.ps1' -TriggerScript 'Notify.ps1' -Parameters @{ Channel = 'ops' }PARAMETERS
-Name
Required trigger name.
-EventType
Required PSU event type that fires the trigger.
-TriggerScript
Required script that runs when the event occurs.
-Script
One associated script for event filtering.
-Scripts
Multiple associated scripts for event filtering.
-Dashboard
App associated with the event.
-Environment
Execution environment for the trigger script.
-Delay
Delay before running the trigger.
-Computer
Execution computer or group.
-Condition
Script block condition that must be satisfied.
-Parameters
Parameter values for the trigger script.
-ComputerName
Target PSU Management API 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.
PERMISSIONS
The access token requires automation.triggers/create to run this cmdlet remotely.
Last updated
Was this helpful?