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.
设置-代理桌面组
禁用或启用现有 BrokerDesktopGroup 或更改其设置。有关此 cmdlet 的更多信息,请参阅 https://citrix.github.io/delivery-controller-sdk/Broker/Set-BrokerDesktopGroup/。
示例
有关如何使用 PowerShell cmdlet 的详细信息,请参阅以下示例。
启用 自动缩放™
- 假设您要为名为“MyDesktop”的交付组启用 Autoscale。请使用
Set-BrokerDesktopGroupPowerShell 命令。例如:PS C:\> Set-BrokerDesktopGroup "MyDesktop" -AutoscalingEnabled $true
分别为高峰时段和非高峰时段配置容量缓冲区
- 假设您要为名为“MyDesktop”的交付组将高峰时段的容量缓冲区设置为 20%,非高峰时段设置为 10%。请使用
Set-BrokerDesktopGroupPowerShell 命令。例如:PS C:\> Set-BrokerDesktopGroup "MyDesktop" -PeakBufferSizePercent 20 -OffPeakBufferSizePercent 10
配置 断开连接超时 设置
- 假设您要为名为“MyDesktop”的交付组将高峰时段的 断开连接超时 值设置为 60 分钟,非高峰时段设置为 30 分钟。请使用
Set-BrokerDesktopGroupPowerShell 命令。例如:PS C:\> Set-BrokerDesktopGroup "MyDesktop" -PeakDisconnectTimeout 60 -OffPeakDisconnectTimeout 30
配置 注销超时 设置
- 假设您希望将名为“MyDesktop”的交付组的 注销超时 值设置为高峰时段 60 分钟,非高峰时段 30 分钟。使用
Set-BrokerDesktopGroupPowerShell 命令。例如:PS C:\> Set-BrokerDesktopGroup "MyDesktop" -PeakLogOffTimeout 60 -OffPeakLogOffTimeout 30
配置 关机延迟 设置
- 假设您希望将名为“MyDesktop”的交付组的关机延迟设置为 15 分钟。使用
Set-BrokerDesktopGroupPowerShell 命令。例如:PS C:\> Set-BrokerDesktopGroup "MyDesktop" -PowerOffDelay 15
配置一个时间段,在此时间段内关机延迟不生效
- 假设您希望名为“MyDesktop”的交付组的关机延迟在 30 分钟后才生效。使用
Set-BrokerDesktopGroupPowerShell 命令。例如:-
C:\PS> Set-BrokerDesktopGroup "MyDesktop" -SettlementPeriodBeforeAutoShutdown 30。
-
配置 计算机实例成本 设置
- 假设您希望将名为“MyDesktop”的交付组的每小时计算机实例成本设置为 0.2 美元。使用
Set-BrokerDesktopGroupPowerShell 命令。例如:PS C:\> Set-BrokerDesktopGroup "MyDesktop" -MachineCost 0.2
将维护模式虚拟机从自动缩放池中排除
-
假设一个交付组有 10 台计算机,其中 2 台处于维护模式。自动缩放缓冲区容量设置为 50%。如果您想将维护模式下的虚拟机从自动缩放池中排除,则将
PoolSizeExcludesMaintenanceMode设置为True。自动缩放将启动 4 台计算机,因为维护模式下的 2 台计算机不包含在计算机池中。使用Set-BrokerDesktopGroupPowerShell 命令。例如:PS C:\> Set-BrokerDesktopGroup -PoolSizeExcludesMaintenanceMode $true
单会话交付组的
PoolSizeExcludesMaintenanceMode默认值为False。多会话交付组的
PoolSizeExcludesMaintenanceMode默认值为True。
新建代理电源时间方案
为交付组创建 BrokerPowerTimeScheme。有关详细信息,请参阅 https://citrix.github.io/delivery-controller-sdk/Broker/New-BrokerPowerTimeScheme/。
示例
假设您要为 UID 值为 3 的交付组创建电源时间方案。新方案涵盖周末、周一和周二。上午 8:00 到下午 6:30 的时间段定义为方案中包含的日期的高峰时段。在高峰时段,池大小(保持开机的计算机数量)为 20。在非高峰时段,池大小为 5。您可以使用 Set-BrokerDesktopGroup PowerShell 命令。例如:
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
用于动态会话超时的参数
以下 Broker PowerShell SDK cmdlet 已通过支持多个新参数而扩展,以实现动态会话超时:
- 获取代理桌面组
- 新建-代理桌面组
- 设置代理桌面组
这些参数包括:
-
DisconnectPeakIdleSessionAfterSeconds – 表示在高峰时段空闲会话断开连接后的秒数。此属性的默认值为 0,表示在高峰时段禁用其关联行为。大于 0 的值仅在高峰时段为交付组启用其行为。
-
DisconnectOffPeakIdleSessionAfterSeconds - 表示在非高峰时段空闲会话断开连接后的秒数。此属性的默认值为 0,表示在非高峰时段禁用其关联行为。大于 0 的值仅在非高峰时段为交付组启用其关联行为。
-
LogoffPeakDisconnectedSessionAfterSeconds - 表示在高峰时段断开连接的会话终止后的秒数。此属性的默认值为 0,表示在高峰时段禁用其关联行为。大于 0 的值仅在高峰时段为交付组启用其关联行为。
-
LogoffOffPeakDisconnectedSessionAfterSeconds - 表示在非高峰时段断开连接的会话终止后的秒数。此属性的默认值为 0,表示在非高峰时段禁用其关联行为。大于 0 的值仅在非高峰时段为交付组启用其关联行为。
示例
假设您想为名为“MyDesktop”的交付组在高峰时段将空闲会话超时设置为 3,600 秒。使用 Set-BrokerDesktopGroup PowerShell 命令。例如:
C:\PS> Set-BrokerDesktopGroup "MyDesktop" -DisconnectOffPeakIdleSessionAfterSeconds 3600
这样做会断开名为“MyDesktop”的桌面组中在非高峰时段空闲超过 1 小时的会话。