This article lists the three ways in which you can programmatically set desktops in a XenDesktop environment into maintenance mode.
The Administrators would like to prevent user connection to the Virtual Delivery Agents while the maintenance period is in effect.
The following procedures require the use of PowerShell Cmdlets.
Maintenance mode can be configured in the following ways:
Set maintenance mode on a single desktop machine through the Set-BrokerPrivateDesktop or Set-BrokerSharedDesktop cmdlets (or the equivalent app desktop cmdlets) with the -InMaintenanceMode parameters to the preceding cmdlets.
Set maintenance mode on a desktop group (which affects all the desktops in that group) through the Set-BrokerDesktopGroup cmdlet, again with the -InMaintenanceMode parameters to preceding cmdlet.
Set maintenance mode on a hypervisor connection through the Set-Item cmdlet on the appropriate pseudo drive item. For example Set-Item -LiteralPath @("XDHyp:\Connections\<HypConnectionName>") -MaintenanceMode <$true/$false>