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. Christina SChristina S12-09-2011

    since out servers are setup to require a reason before shutting down I suspected that the subroutine for reboot was the culprit. We also use psshutdown from sysinternals. So, I changed the reboot sub routine to this and it worked perfectly:

    sub StartReboot
    AssignLE(strServerLoadEvaluator) ‘Reset the Load Evaluator on this server back to the default
    wscript.sleep(5000) ‘Wait for 5 seconds after applying the load evaluator
    Log “Initiating reboot process on ” & strServer & “.”, “911” ‘Write a 911 event to the log when rebooting the server“psshutdown \” & strServer & ” -f -r -t 0 -e p:4:1″) ‘Reboot
    end sub

    • youngtechyoungtech12-09-2011


      That’s excellent to hear! My colleagues and I put a lot of thought into which technologies to use to accomplish this end goal long before I developed and published the script. We came to the conclusion that a combination of VBscript and PowerShell would be the best choice. Our decision criteria was simple, that the output be open source and available for modifications by the Citrix community to fit specific needs!

      I’m glad you were able to tailor what I provided to fit your needs. While I am available to make feature enhancements, it always makes me smile when people aren’t afraid to get in and get their hands dirty with a little scripting!

      Great work,

  2. Christina SChristina S12-08-2011

    OK. here is a tricky one..the script is running, the servers rebooting. However, after the POST, the server hangs and IMA services along with all other required citrix services do not start. This only happens when I run the script. It does not happen when I run psshutdown or do a local reboot. I have my citrix service account as a local admin as well as a citrix admin in the AMC. Any ideas?

  3. RickRick12-08-2011

    Youngtech, I have another suggestion. As users log off and on 24×7, it is a real possibility that the rolling-reboot could be held up by one server, with users who work through the night. Build your array of servers with a T/F switch, then set each server to block logons. test for user sessions, if there are any, move to the next server and repeat the process. Then reboot servers as you come across empty ones. Once the server is rebooted set the switch to .T. so that you don’t process it again. Keep going through the array, until all the servers reboot switches are cleared.

    • youngtechyoungtech12-19-2011

      One concern, and the reason why the script was built to pull out only a single server, is that most customers are only built for N+1 availability. Pulling multiple servers out of load balancing can be done with modified logic in this script, but I don’t think it fits most customer environments. If you start going that route you would need to start talking about peak hours and off hours and modifying the max number of servers that can be pulled based on the time of the day. When discussing with other engineers and our customers we decided it’s better to have the script wait for 3 weeks (for example) if there’s a never ending session than to not process reboots at all. Ideally you would have your disconnected, idle, etc. session timeouts set to purge sessions so that this behavior does not hold up a particular server for too long. Hope this helps. Thanks for the feedback!

  4. Christina SChristina S12-08-2011

    When I try to launch an app that is explicitly published from a server that is in the middle of a reboot I get a dialog box that says: “Citrix Online Plug-in” The remote server failed to execute the application launch request. Please contact your administrator for further deatils.

    This is with the normal production LE applied. Which is what would be applied directly before a reboot after the script reports context switches have dropped below the threshold of 1. When I did this process manually, I always waited until after the reboot the apply the production LE so this message would not be an issue. I work for a hospital and people are constantly launching and using the application 24/7 and our user group are they type of people who would call the help desk and the helpdesk would call me in the middle of the night.

  5. Christina SChristina S12-08-2011

    I have Xen App 4.5 HRP 5 Windows 2003 x64 R2 SP2. What happens when the LE is set back to normal production levels, the server then particiaptes in application delivery..if it is down or unavalible, the end user gets, “The requested applition is not avalible” (not verbaitum but very close) until the server comes back up.

Leave a Reply