Invoke-PSUTerminalCommand
SYNOPSIS
Invokes a command in a terminal instance.
SYNTAX
Invoke-PSUTerminalCommand -TerminalInstance <TerminalInstance> -Command <String> [-ComputerName <String>]
[-AppToken <String>] [-Credential <PSCredential>] [-UseDefaultCredentials] [-Integrated] [-TrustCertificate]
[-Cookies] [<CommonParameters>]DESCRIPTION
Invokes a command in a terminal instance. You can start new terminal instances with Start-PSUTerminalInstance and return running instances with Get-PSUTerminalInstance.
EXAMPLES
Example 1
PS C:\> $Terminal = Get-PSUTerminal | Where-Object Name -eq 'Terminal1'
PS C:\> Start-PSUTerminalInstance -Terminal $Terminal
PS C:\> $Instance = Get-PSUTerminalInstance
PS C:\> Invoke-PSUTerminalCommand -TerminalInstance $Instance -Command 'Write-Host "Hello, World!"'Creates a new terminal instance of Terminal1 and then invokes a command within it.
PARAMETERS
-AppToken
An App Token for authenticating against the PowerShell Universal server.
-Command
The command to invoke
-ComputerName
The name or URL of the PowerShell Universal server.
-Integrated
Not Supported
-TerminalInstance
The terminal instance within which to invoke the command. Use Get-PSUTerminalInstance to return running instances.
-UseDefaultCredentials
The terminal configuration to start. Use Get-PSUTerminal to return terminal configurations.
-Credential
Credentials to login to the PowerShell Universal Management API.
-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
PowerShellUniversal.TerminalInstance
OUTPUTS
System.Object
NOTES
RELATED LINKS
PERMISSIONS
The access token requires automation.terminals/execute to run this cmdlet remotely.
Last updated
Was this helpful?