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 Remote PowerShell SDK version 7.21.0.12 or later. For more information about the Remote PowerShell SDK, seeSDKs and APIs.
Set-BrokerDesktopGroup
Disables or enables an existing BrokerDesktopGroup or alters its settings. For more information about this cmdlet, seehttps://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 thewhen disconnected timeoutsetting
- Suppose you want to set thewhen disconnected timeoutvalue 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 thewhen logged off timeoutsetting
- Suppose you want to set thewhen logged off timeoutvalue 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 thepower-off delaysetting
- 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 themachine instance costsetting
- 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, seehttps://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 theSet-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——代表了时间在秒后一个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 theSet-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.”