Skip to content

Invoke-CitrixMachineCommand

Citrix: Invokes a machine command

param(
	[Parameter(Mandatory = $true)]
	[string]$MachineName,

	[Parameter(Mandatory = $true)]
	[ValidateSet('TurnOn', 'TurnOff', 'Restart', 'Shutdown')]
	[string]$Action
)

try {
	Import-Module Citrix.Broker.Admin.V2 -ErrorAction Stop
	New-BrokerMachineCommand -MachineName $MachineName -Category Power -Command $Action -ErrorAction Stop
	Write-Output "Successfully invoked '$Action' on machine '$MachineName'."
} catch {
	Write-Error $_
	exit 1
}

The name of the machine.

The action to perform (e.g. TurnOn, TurnOff, Restart).

An interactive directory of PowerShell scripts.