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. NikkiNikki01-17-2012

    Hi –

    I’d like to thank for publishing this script. We’re 24×7 shop and this script is a life saver for me. The script is working fine when I first tested it in our environment. It worked fawlessly. However,we’re running into the server hung at shutting down. The server was in shutting down state for a couple of days and won’t reboot until I reset it in VCenter. All our Xenapp are running on VMWare. I was wondering if anyone is having the same issue.

  2. KjetilKjetil01-04-2012

    I finally got the script working, but I’m not 100% sure what made it happen… Thanks for a great script!

  3. Michael MereaganMichael Mereagan01-03-2012

    Thank you Young Tech for the script. Excellent use case if I can get it to work in my Lab (VMware Vsphere5, XA6.5 patched, 2008 R2 SP1, Windows firewall off). I have followed instructions setting up the scheduled job in windows but I get ” the task is current running (0x41301)” message is scheduler. Per my web search, I am using a domain admin account set to Run with highest privileges, with pemission to logon as a service but with the same result. The script does not produce the desired event. I am getting no error messages in eventvwr at all and I am not sure where to look to trouble shoot. Any comments would be useful; I would like very much to get this script working.


    • youngtechyoungtech01-04-2012


      If the script is truly running you should see several entries in the Application event log with the source of “Citrix Rolling Reboot”. Also, open up Task Manager to see all processes from all users and see if PowerShell.exe is running. You can kill any running PowerShell processes and attempt to restart the scheduled task.

      Upon startup the script will immediately log several entries to the Application Event Log. Also, just to rule this out, open a PowerShell window and execute “Set-ExecutionPolicy Bypass -Scope LocalMachine” to change the Execution Policy. If in doubt, refer to my word document (attached above) for instructions on setting up the appropriate Scheduled Task switches to bypass the execution policy.


  4. KjetilKjetil12-23-2011

    I have verified manually that I can use “shutdown -f -r -t 0 -m \servername” and put that in to the script, but it didn’t make any difference. The server is still not rebooting.

    • RasmusRasmus12-28-2011

      Is the scheduled task set to “Run with highest privileges”?

      Otherwise, I suspect it might not have permission to perform shutdowns or reboots.

  5. KjetilKjetil12-20-2011

    There are no sessions on the server with NoLogon LE assigned.

    • youngtechyoungtech12-21-2011

      You could be experiencing the same issue that Christina reported above. Do you know if you can use “shutdown.exe -f -r -t 0 -m \servername” in your environment to reboot servers? If not, your servers may require a reason to shutdown. If so, modify the script to use the reason switches Christina mentioned. Please leave feedback with your results. Thanks in advance!

1 3 4 5 6 7 25

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