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. Cliff DaviesCliff Davies01-07-2013

    Could you explain the puirpose of adding copyright nomenclature to the script:

    “Added Copyright tag lines to top and bottom of the scripts.”

    Is this reboot script not a free tool? Are there restrictions to using this script and if so, what are they?

    • Dane YoungDane Young01-17-2013

      Hi Cliff,

      Thanks for your feedback. I have sent you a response on Twitter, but I wanted to make sure others knew there were no restrictions with the script for personal or professional use. Simply leave my name and credit in the header and footer of the script.

      Thanks,
      –youngtech

  2. DréDré01-05-2013

    Dane,

    First of all thanks a lot for this very useful script and the effort you put into it. It works like a charm!

    The one question/problem I have is that the script apparently only looks for active sessions. If users are in a disconnected state, the script will fire up and reboot the server. We have a policy that allows people to be disconnected for 3 hrs. So that they can continue their work from home. I guess the following problem could arise : The last active user on a server disconnects his session so he can continue to work from home 2 hrs later, leaving his word document open. If he/she is on the server next on the list to be rebooted and work was not saved, our help-desk could be confronted with a rather “frustrated” user.

    What’s your thought on this?

    Thanks!
    Dré

    • Dane YoungDane Young01-17-2013

      Dre,

      This is actually very simple to modify if you do not want to bounce disconnected sessions. Simply change the following line to remove the Where statement regarding Disconnected sessions. Change:
      $sessions = @(get-xasession | Where {$_.ServerName -eq $server} | Where {$_.State -ne “Listening”} | Where {$_.State -ne “Disconnected”} | Where {$_.SessionName -ne “Console”})
      To
      $sessions = @(get-xasession | Where {$_.ServerName -eq $server} | Where {$_.State -ne “Listening”} | Where {$_.SessionName -ne “Console”})

      I decided it was best to ignore disconnected sessions as I can’t assume that every environment has disconnect session timeouts configured. Let me know if this helps.
      Thanks,
      –youngtech
      dane@itvce.com

      • SoniaSonia02-08-2013

        Great Script! I am still working with a XenApp5 farm, and can’t bounce servers that have “disconnected sessions”, unfortunately not a vbs scripter….could you tell me what I need to edit to exclude servers if they have disconnected sessions???? Thanks in advance!

        • Dane YoungDane Young12-04-2014

          Hi Sonia,

          Find the following lines:

          if SessionState(aSession.SessionState)<>“Disconnected” then ‘Don’t count disconnected sessions
          sess=sess+1
          end if

          and simply change them to:

          sess=sess+1

          This should ensure Disconnected sessions aren’t flushed automatically. Please be sure to set proper disconnected session timeout values, otherwise the servers will never reboot.

          Thanks!
          -youngtech

  3. Hang ChengHang Cheng01-02-2013

    This is a very nice script. All of our XenApp 6.5 servers are Virtual servers on XenServer 6.1 and provisioned by PVS 6. What we’re running into is that some of the servers froze and would not take the reboot script. We had to use force reboot via XenCenter or PowerShell for XenCenter. Do you think you can incorporate the XenCenter PowerShell script to force reboot stuck or frozen VMs?

    Thanks.

    Hang

    • Dane YoungDane Young01-17-2013

      Hang,

      I’m afraid this is out of the scope of what I intended for the script. However, it’s intentionally kept open source, so if you would like to add those modifications to the PowerShell logic, you may be my guest. Ultimately I would want to determine why XenServer is not allowing those VMs to reboot since it’s a very simple Shutdown.exe command for the reboots.

      Thanks,
      –youngtech

  4. SaschaSascha01-02-2013

    Thanks, for your great job.
    But I have one question regarding

    – The script checks to see if the script is already running (Since Task Scheduler is not smart enough to prevent multiple instances from spawning)

    what it exatly will be checked whether powershell is running?, because We have a lot of sheduled tasks that are running at the same time. I got an event script already running ..
    Thanks in Advance and a Happy New Year 🙂

    • Dane YoungDane Young01-17-2013

      Sascha,

      This is exactly what it’s checking for. It does a Get-Process to look for PowerShell.exe. If PowerShell.exe is running, the script terminates. If you can think of a better way to accomplish this, I’m all ears. What I don’t want is for several simultaneous threads to be all processing server reboots as that would become a nightmare.

      Thanks for your feedback!
      –youngtech

  5. John ProvostJohn Provost12-30-2012

    Firstly, thanks for the scripts. I have both a XA 5 and a XA6.5 farm. The trouble I am experiencing is as following:

    XA5- The initial running of the script appears to have worked. All servers rebooted, or were in the process of rebooting before I terminated the Script. Afterwards, only two of my 9 servers would reboot and now none of them will. The event logs show the script running and claims that all servers have rebooted, however this is not the case.

    XA65 – Similiar story, the script will run, however, it appears to hang and not reboot the server. It looks as if it is putting it into the NoLogon LE but that is where it stops.

    Thanks for the help!

    • Dane YoungDane Young01-17-2013

      Hi John,

      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.
      Thanks,
      –youngtech
      dane@itvce.com

1 6 7 8 9 10 25

Leave a Reply