Using Powershell to Schedule Tag based Reboots for a Delivery Group in XenDesktop 7.12+

Using Powershell to Schedule Tag based Reboots for a Delivery Group in XenDesktop 7.12+

August 2, 2017 0 By Amir Joseph Sayes

The scenario
You have multiple delivery groups in your XenDeskop/XenApp 7.12+, and you would like to use Powershell to Schedule Tag based Reboots for a Delivery Group
A tag is simply a mark or a label. Assuming you have a delivery group (A) with 20 machines assigned to it. You can label 10 of those machines with a tag “Z” for instance, and the other 10 with tag “X” then you can configure your weekly reboots to reboot the “X”s on Staurdays and the “Z”s on Sunday for instance.
In this blog, I am going to be tagging the members (machines) of my Delivery Group based on the last 2 numbers of the server name; the script will check the name and tag it with “Odd” tag if the server name ends with and odd number e.g. compuer110 and the same logic applies to even numbers.

The Tagging Script
The script below will tag members of DGs as evens and odds based on the last 2 digits in the name. You can tweak the script to accomplish tagging based on other criteria if you like.

The output would be something like this:

The Scheduled Reboots Script
New-BrokerRebootScheduleV2 command requires  the switch –desktopgroupid; to get this value for your Delivery Group, run:

Now that you have your DG UID, you will need to decide on the frequency, day and the time, etc…
To map your scheduled reboot to a certain tag, use the switch –RestrictToTag

Below, I am creating a scheduled reboot for each tag, one for evens on Saturdays and another for odds machines on Sunday:

The output would be something like this:

2017-08-02 16_40_04-PWGSXAGSEMDC103 - Remote Desktop Connection Manager v2.7

To verify what has been configured use:

To remove a scheduled reboot use:

Happy scripting!

References: Citrix Blogs