Monday, 10 February 2014

Citrix XenDesktop Reboot Powershell

The following powershell could be used on a Desktop controller to perform reboots. This script could be run with a scheduleded task.

This can be handy for things like Physical machine catalogs which dont have Xendesktop power management control.

$machines = Get-BrokerMachine -CatalogName "CatalogXX" -PowerState On

foreach ($machine in $machines)
{
write-host $machine.hostedMachineName $machine.LastHostingUpdateTime
if ( ( get-date $machine.LastHostingUpdateTime ).day -lt ( get-date ).day )
{
New-BrokerHostingPowerAction -Action Restart -MachineName $machine.HostedMachineName
}
}

No comments:

Post a Comment