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

Invoke-PSUScript

Invokes a script within PSU.

SYNOPSIS

Invokes a script within PSU.

SYNTAX

Script

Invoke-PSUScript [-Script] <Script> [-WaitForDebugger] [-Environment <String>] [-Notes <String>]
 [-Credential <Variable>] [-Wait] [-Queue <String>] [-WaitTimeout <Int32>] [-Parameters <Hashtable>]
 [-Tags <Tag[]>] [-Silent] [-ComputerName <String>] [-AppToken <String>] [-UseDefaultCredentials] [-Integrated]
 [-TrustCertificate] [-Cookies] [<CommonParameters>]

Id

Invoke-PSUScript [-Id] <Int64> [-WaitForDebugger] [-Environment <String>] [-Notes <String>]
 [-Credential <Variable>] [-Wait] [-Queue <String>] [-WaitTimeout <Int32>] [-Parameters <Hashtable>]
 [-Tags <Tag[]>] [-Silent] [-ComputerName <String>] [-AppToken <String>] [-UseDefaultCredentials] [-Integrated]
 [-TrustCertificate] [-Cookies] [<CommonParameters>]

Name

Invoke-PSUScript [-WaitForDebugger] [-Environment <String>] [-Notes <String>] [-Credential <Variable>]
 [-Name] <String> [-Wait] [-Queue <String>] [-WaitTimeout <Int32>] [-Parameters <Hashtable>] [-Tags <Tag[]>]
 [-Silent] [-ComputerName <String>] [-AppToken <String>] [-UseDefaultCredentials] [-Integrated]
 [-TrustCertificate] [-Cookies] [<CommonParameters>]

DESCRIPTION

Invokes a script within PSU. Invoking a script starts a new job that you can then track the progress of.

EXAMPLES

Example 1

Invokes 'Script1.ps1'

Example 2

Invokes 'Script1.ps1' with the parameters Parameter1 and Parameter2. These parameters will be passed to the script. Invoke-PSUScript supports any number of dynamic parameters.

Example 3

Invokes 'Script1.ps1' as the user 'adam'. Passwords are retrieved from secret managers and cannot be passed in as strings.

PARAMETERS

-AppToken

An app token to access the PSU API.

-ComputerName

The HTTP address of the PSU REST API server.

-Credential

The credential of the user to run the script as. Use New-UACredential to create this credential.

-Environment

The environment to use when invoke this script. You can see available environments by using Get-PSUEnvironment.

-Id

The ID of the script to invoke.

-Integrated

Executes the command internally rather than using the Management API. Only works when running script from within PowerShell Universal.

-Name

The name of the script to invoke.

-Notes

Notes to include with the job execution.

-Script

The script to invoke. Use Get-PSUScript to retrieve existing scripts.

-UseDefaultCredentials

Use default credentials when connecting to the management API

-Wait

Waits for the script to execute before returning.

-WaitForDebugger

Not used.

-Queue

The computer, computer group or queue to run this script against.

-Parameters

A hashtable of parameters to pass to the script. This can be used instead of dynamic parameters on this cmdlet.

-WaitTimeout

The number of seconds to wait.

-Silent

Prevents interaction with the current PowerShell host. Will not write to streams or invoke Read-Host.

-Tags

Tags to apply to the job.

-TrustCertificate

Whether the cmdlet should ignore certificate issues.

-Cookies

Reuses and persists authentication cookies for the current PowerShell session.

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -Verbose, -WarningAction, -WarningVariable, and -ProgressAction. For more information, see about_CommonParameters.

INPUTS

UniversalAutomation.Script

System.Int64

OUTPUTS

System.Object

NOTES

Get-PSUEnvironment

Last updated

Was this helpful?