These enhancements mean that nowadays, many (maybe even most) environments can leverage the built-in reboot mechanism, which is great because that is one less script/customization you need to maintain and worry about. By the way, if you haven’t already, you should also take a moment to read the post Reboot Schedule Internals to get a clearer understanding of how the built-in reboot mechanism works.
However, there are still some gaps around reboot frequency other than daily or weekly and the ability to disable logons on XenApp servers ahead of time in order to minimize disruption to users, which drive the need for some kind of custom, scripted reboot process for some customers. These requirements seem to be more common in environments with multi-shift 24/7 operations such as call centers, manufacturing, and healthcare.
Citrix received a few common requests for updates, including:
- Can we use a reboot script with Citrix Cloud? – Yes we can!
- Could I make it easier for people to modify the script as needed? – I can certainly try 😊
- Wouldn’t it be nice if it had some error handling and logging? – Absolutely!
So, between PowerShell cmdlet updates we have added to the product and these requests for functionality enhancements, I decided it was time for an updated script! I went ahead and added Citrix Cloud integration, broke up the key parts of the script into functions so it is easier to identify what each chunk of code does, and added basic error handling and event logging.
A few things to consider:
- Instructions on how to run the script can be found in the script’s comments at the top.
- This solution is OS agnostic.
- The script assumes all machine names end with a number.
- The script requires that you provide the name of the Delivery Group the machines belong to and the parity of the machine to be rebooted.
- The script must be run as an administrator.
- You need to create Scheduled Tasks to run the script automatically on a schedule. For an on-premises XenApp environment, the tasks need to be scheduled on a Delivery Controller. For Citrix Cloud, see below for Citrix Cloud considerations.
- You will need a Scheduled Task for every group of machines to be rebooted (e.g. Delivery Group #1 – Even, Delivery Group #1 – Odd, …, Delivery Group #n – Even, Delivery Group #n – Odd).
- You can enable/disable the Citrix Cloud portion with a parameter (see instructions for details).