For the complete documentation index, see llms.txt. This page is also available as Markdown.

New-PSUTrigger

SINOSSI

Crea un nuovo trigger di Automation in PowerShell Universal.

SINTASSI

New-PSUTrigger -Name <String> -EventType <EventType> -TriggerScript <Script> [-Script <Script>]
 [-Dashboard <Dashboard>] [-Environment <String>] [-Delay <Int32>] [-Computer <String>]
 [-Condition <ScriptBlock>] [-ComputerName <String>] [-AppToken <String>] [-Credential <PSCredential>]
 [-UseDefaultCredentials] [-Integrated] [-TrustCertificate] [-Cookies]
 [<CommonParameters>]

DESCRIZIONE

Crea un nuovo trigger di Automation in PowerShell Universal. I trigger di Automation di PowerShell Universal consentono di eseguire script in base a eventi all'interno di PowerShell Universal. È possibile eseguire script quando altri script hanno esito negativo, quando le dashboard si arrestano o quando il server è in fase di avvio.

I trigger sono archiviati nel file ./universal/triggers.ps1.

È inoltre possibile utilizzare questo cmdlet per creare trigger tramite l'API REST.

ESEMPI

Esempio 1

Crea un nuovo trigger che richiama il file ScriptFailed.ps1 quando un qualsiasi processo all'interno di PowerShell Universal ha esito negativo.

Esempio 2

Crea un nuovo trigger che richiama il file DashboardStopped.ps1 quando la dashboard MyDashboard si arresta.

Esempio 3

Crea un nuovo trigger che richiama il file LogServerStart.ps1 quando il server PowerShell Universal viene avviato.

PARAMETRI

-AppToken

Il token dell'app per accedere all'API di gestione di PowerShell Universal.

-ComputerName

Il nome del computer o l'URL del server Powershell Universal.

-Dashboard

Trigger per una dashboard specifica.

-Environment

L'ambiente in cui eseguire lo script attivato.

-EventType

L'evento che causa questo trigger.

-Name

Il nome di questo trigger. Deve essere univoco.

-Script

Lo script che causa questo trigger.

-TriggerScript

Lo script da attivare quando questo trigger viene attivato.

-UseDefaultCredentials

Utilizza le credenziali predefinite durante la connessione all'API di gestione

-Delay

Specifica il ritardo tra le esecuzioni.

-Integrated

Esegue il comando internamente anziché utilizzare l'API di gestione. Funziona solo quando lo script viene eseguito all'interno di PowerShell Universal.

-Computer

Il computer o la coda su cui eseguire questo trigger.

-Condition

Un blocco di script di condizione per determinare se eseguire o meno questo trigger.

-Credential

Credenziali per accedere all'API di gestione di PowerShell Universal.

-TrustCertificate

Indica se il cmdlet deve ignorare i problemi relativi ai certificati.

-Cookies

Riutilizza e mantiene i cookie di autenticazione per la sessione PowerShell corrente.

CommonParameters

Questo cmdlet supporta i parametri comuni: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -Verbose, -WarningAction, -WarningVariable e -ProgressAction. Per maggiori informazioni, veda about_CommonParameters.

INPUT

Nessuno

OUTPUT

System.Object

NOTE

COLLEGAMENTI CORRELATI

Ultimo aggiornamento

È stato utile?