Citrix Chained Reboot Scripts, now supporting Citrix Cloud, Citrix Virtual Apps and Desktops (CVAD), and XenApp/XenDesktop 5, 6, 6.5, and 7.x!

Share Button

Updated 2018.12.22: Revision 1.9 Now Supports Citrix Cloud!

One script now works with all current and modern versions of XenApp, XenDesktop, Citrix Virtual Apps and Desktops (CVAD), and Citrix Cloud Virtual Apps and Desktops Service from 7.0 and later, through 1811.

In zero-downtime 24/7 environments with shift employees, customers rarely want users to be notified of scheduled or mandatory XenApp server reboots. As a result, most of these environments have reboots disabled or this process is done manually. Unfortunately, this isn’t a good process since the XenApp servers are susceptible to memory leaks which can lead to failure and poor performance. By utilizing the included Chained reboot scripts, environments can take advantage of N+1 overallocation by processing a single server reboot while maintaining the user load on remaining systems. This has been done in such a way that users are not kicked off the system for scheduled reboots.  Instead, the server is removed from load balancing until all sessions have been logged off. Once all sessions have been logged off, the server will go down for a reboot.

Share Button
  1. murdamurda12-28-2012

    Hi Dane Young,

    Thanks for the wonderfull script.
    Could I make one suggestion?

    Add a log off force option in the script.If it’s a 24/7 script there needs to be a force logon function in it.
    We have a 24/7 company where production users never log off because the monitor system changes in production levels. I already set the log off when idle on 2hours but this doesn’t solve our problem.

    We like to see a force log off at a preset time on the “nologon” server.
    Saying “server will be shutdown at 2.00 – Please save and log off ….”

    Now I need to manually force the remaining users to log off.

    Thanks for reading.

    • Dane YoungDane Young01-17-2013


      In this case, why don’t you simply use the built-in Citrix reboot procedures? They do a great job of forcing notifications and reboots, that was not the purpose of the Rolling Reboot scripts. The Rolling Reboot scripts were intended to perform unintrusive reboots on the systems, no user notifications involved.


  2. O PostO Post12-27-2012


    I can confirm that the error “Unhandle error has occurred” is solved.

    But their is another issue with the script.
    When I use default settings, FarmloopInterval=24 and rebootthisserver = $false it’s only rebooting the servers once. In the event Viewer I can find messages like:

    08:00 – It has been 22 hours since last loop for ‘AllServers’. Waiting for another 2 hours.
    09:00 – It has been 23 hours since last loop for ‘AllServers’. Waiting for another 1 hours.
    10:00 – It has been 0 hours since last loop for ‘AllServers’. Waiting for another 24 hours.
    11:00 – It has been 1 hours since last loop for ‘AllServers’. Waiting for another 23 hours.

    As you can see their is no reboot task executed between 09 and 10.
    First time it works but after that it is looks like a never ending loop with no more reboots.

    And if you have SMTP to true it spams you a lot with emails. Recommend you to collect this info and send it only once during the farmloopinterval.

    Thank you for your support and keep it up! 🙂

    • Dane YoungDane Young01-17-2013


      I received your feedback on my Rolling Reboot blog post. I’m wondering if you have had any further success with the script or to see if it’s still failing? If you are willing, I’d love to take a couple minutes to look over your farm and XenApp environment to see if there’s anything obvious that I may be missing in my approach?

      Let me know if you are interested, I’m constantly trying to improve the tool and would love to see why it’s failing.

  3. O PostO Post12-20-2012

    Great, I’m testing the new version now.
    I would recommend that you change the script so that it only sends out an e-mail during the restart period. Now it sends out e-mail for every task it performs. Or you could make it as an option, SendEmailEveryTask = True or SendEmailReportAfterCycle…
    You deserves credit for the work you have done here, thank you!

  4. OPostOPost09-12-2012


    This is a awsome script and would had helped us a lot.
    I am getting an error after my 4 servers are rebooted.
    Unhandled error has occurred in main program: The operation ‘[System.Int32] – [System.TimeSpan]’ is not defined.

    Running XenApp 6.5, Windows Server 2008 R2 and XenApp6.5_Citrix_Rolling_Reboot_Rev5.ps1

    Do you know how I can fix this?

    Thank you.

    • PeterPeter11-19-2012

      im getting same error – Unhandled error has occurred in main program: The operation ‘[System.Int32] – [System.TimeSpan]‘ is not defined.

      first reboot cycle is fine,
      first “it has been 0 hours since last loop. waiting 24 hours.” is fine
      one hour after crash.

      running xenapp 6.0 w2k8r2 – script for xenapp 6 farms build 2011.12.05 revision 5

      • Dane YoungDane Young12-02-2012


        This has definitely been resolved in Rev. 6. Please try the latest code and report back if there are still issues.


1 5 6 7 8 9 25

Leave a Reply to Dane Young Click here to cancel reply.