Citrix Virtual Apps and Desktops

Broker PowerShell SDK commands

You can configure Autoscale for delivery groups using the Broker PowerShell SDK. To configure Autoscale using PowerShell commands, you must use PowerShell SDK version 7.21.0.12 or later. For more information about the PowerShell SDKs, see SDKs and APIs.

Set-BrokerDesktopGroup

Disables or enables an existing BrokerDesktopGroup or alters its settings. For more information about this cmdlet, see https://citrix.github.io/delivery-controller-sdk/Broker/Set-BrokerDesktopGroup/.

Examples

See the following examples for details about how to use the PowerShell cmdlets.

Enable Autoscale

  • Suppose you want to enable Autoscale for the delivery group whose name is “MyDesktop.” Use the Set-BrokerDesktopGroup PowerShell command. For example:
    • PS C:\> Set-BrokerDesktopGroup "MyDesktop" -AutoscalingEnabled $true

Configure the capacity buffer separately for peak and off-peak times

  • Suppose you want to set the capacity buffer to 20% for peak times and 10% for off-peak times for a delivery group whose name is “MyDesktop.” Use the Set-BrokerDesktopGroup PowerShell command. For example:
    • PS C:\> Set-BrokerDesktopGroup "MyDesktop" -PeakBufferSizePercent 20 -OffPeakBufferSizePercent 10

Configure the when disconnected timeout setting

  • Suppose you want to set the when disconnected timeout value to 60 minutes for peak times and 30 minutes for off-peak times for a delivery group whose name is “MyDesktop.” Use the Set-BrokerDesktopGroup PowerShell command. For example:
    • PS C:\> Set-BrokerDesktopGroup "MyDesktop" -PeakDisconnectTimeout 60 -OffPeakDisconnectTimeout 30

Configure the when logged off timeout setting

  • Suppose you want to set the when logged off timeout value to 60 minutes for peak times and 30 minutes for off-peak times for a delivery group whose name is “MyDesktop.” Use the Set-BrokerDesktopGroup PowerShell command. For example:
    • PS C:\> Set-BrokerDesktopGroup "MyDesktop" -PeakLogOffTimeout 60 -OffPeakLogOffTimeout 30

Configure the power-off delay setting

  • Suppose you want to set the power-off delay to 15 minutes for a delivery group whose name is “MyDesktop.” Use the Set-BrokerDesktopGroup PowerShell command. For example:
    • PS C:\> Set-BrokerDesktopGroup "MyDesktop" -PowerOffDelay 15

Configure a time period during which the power-off delay does not take effect

  • Suppose you want the power-off delay to take effect until 30 minutes have elapsed for a delivery group whose name is “MyDesktop.” Use the Set-BrokerDesktopGroup PowerShell command. For example:
    • C:\PS> Set-BrokerDesktopGroup "MyDesktop" -SettlementPeriodBeforeAutoShutdown 30.

Configure the machine instance cost setting

  • Suppose you want to set the machine instance cost per hour to 0.2 dollars for a delivery group whose name is “MyDesktop.” Use the Set-BrokerDesktopGroup PowerShell command. For example:
    • PS C:\> Set-BrokerDesktopGroup "MyDesktop" -MachineCost 0.2

New-BrokerPowerTimeScheme

Creates a BrokerPowerTimeScheme for a delivery group. For more information, see https://citrix.github.io/delivery-controller-sdk/Broker/New-BrokerPowerTimeScheme/.

Example

Suppose you want to create a power time scheme for a delivery group whose UID value is 3. The new scheme covers the weekend, Monday, and Tuesday. The 8:00 AM to 6:30 PM time slot is defined as peak times for the days included in the scheme. For peak times, the pool size (the number of machines kept powered on) is 20. For off-peak times, it is 5. You can use the Set-BrokerDesktopGroup PowerShell command. For example:

  • PS C:\> $ps48=(0..47 | %{ if ($_ -lt 16 -or $_ -gt 37) { 5 } else { 20 } } )
  • PS C:\> $pt48=(0..47 | %{ if ($_ -lt 16 -or $_ -gt 37) { $false } else { $true } } )
  • PS C:\> New-BrokerPowerTimeScheme -Name 'First Half Week' -DaysOfWeek Weekend,Monday,Tuesday -DesktopGroupUid 3 -PeakHalfHours $pt48 -PoolSize $ps48

Parameters for dynamic session timeouts

The following Broker PowerShell SDK cmdlets have been extended for dynamic session timeouts by supporting multiple new parameters:

  • Get-BrokerDesktopGroup
  • New-BrokerDesktopGroup
  • Set-BrokerDesktopGroup

Those parameters include:

  • DisconnectPeakIdleSessionAfterSeconds – Represents the time in seconds after which an idle session is disconnected during peak time. This property has a default value of 0, which indicates the disablement of its associated behavior during peak time. A value greater than 0 enables its behavior for the delivery group during peak time only.

  • DisconnectOffPeakIdleSessionAfterSeconds - Represents the time in seconds after which an idle session is disconnected during off-peak hours. The default value of this property is 0, which indicates the disablement of its associated behavior during off-peak. A value greater than 0 enables its associated behavior for the delivery group during off-peak hours only.

  • LogoffPeakDisconnectedSessionAfterSeconds - Represents the time in seconds after which a disconnected session is terminated during peak time. The default value of this property is 0, which indicates the disablement of its associated behavior during peak time. A value greater than 0 enables its associated behavior for the delivery group during peak time only.

  • LogoffOffPeakDisconnectedSessionAfterSeconds - Represents the time in seconds after which a disconnected session is terminated during off-peak hours. The default value of this property is 0, which indicates the disablement of its associated behavior during off-peak. A value greater than 0 enables its associated behavior for the delivery group during off-peak hours only.

Example

Suppose you want to set the idle session timeout to 3,600 seconds during peak times for a delivery group whose name is “MyDesktop.” Use the Set-BrokerDesktopGroup PowerShell command. For example:

  • C:\PS> Set-BrokerDesktopGroup "MyDesktop" -DisconnectOffPeakIdleSessionAfterSeconds 3600

Doing that disconnects sessions that have been idle for more than 1 hour in off-peak for the desktop group whose name is “MyDesktop.”

Broker PowerShell SDK commands