This is a task you will have likely carried out, on a regular basis during your day to day Citrix farm administration. You have Citrix VDA machines that you need to put in maintenance mod. Maybe it’s one machine, maybe it’s a dozen. The reasons can be to carry out maintenance, or upgrades. Whatever the reason, yes you can do it via Studio, but what about PowerShell?
Of course you can do it via PowerShell too! If you’re like me and more interested in getting comfortable with PowerShell then here’s a little note on how to put machines in maintenance mode via PowerShell with a few example scenarios.
Firstly, launch PowerShell either via studio or by running Add-PSSnapin Citrix.* within your PowerShell console.
Machines used in scenarios:
Scenario 1 – Put CitrixDesktop1 in to maintenance mode
- Set-BrokerMachineMaintenanceMode -InputObject DOMAIN\CitrixDesktop1 $true
- Get-BrokerMachine -MachineName DOMAIN\CitrixDesktop1 | fl InMaintenanceMode
The first command sets the machine in maintenance mode. The second queries for the end result.
Scenario 2 – Put CitrixDesktop1 and CitrixDesktop2 in to maintenance mode
- Set-BrokerMachineMaintenanceMode -InputObject DOMAIN\CitrixDesktop1, DOMAIN\CitrixDesktop2 $true
Scenario 3 – Put all three machines in to maintenance mode
- $machines = Get-BrokerMachine -MachineName DOMAIN\CitrixDesktop*
- Set-BrokerMachineMaintenanceMode -InputObject $machins $true
The first command gets a list of machines with CitrixDesktop in their name. The second puts them in to maintenance mode.