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. NateshNatesh06-27-2012

    I am very new to powershell Scripting(A week old), This script is rebooting all the servers in the farm, but however, I have a limitation that i can have to finish up rebooting within 3 hours.

    3 hours on Sunday: Even numbered servers
    3 hours on Monday: Odd numbered servers

    Hence I wanted a script which read server list from TEXT file and do the below:

    1. Get the LE applied on the servers and export it to TEXT file.
    2. Apply the Offline Load Evaluator.
    3. See the IDEL session which is more that 1 hour and dissconected session, which should be reset.
    4. Send the 3 messages to the users who is active on the server. in 5 min interval.
    5. After 10 min, from all 3 messages, reset the sessions and reboot the server.
    6. wait for the server to be up, and then re-apply the LE back by checking the text file which we exported in step 1.

    I was to achive this partially by

    foreach ($server in (Get-Content D:\Server.txt))


    Get-XALoadEvaluator -ServerName $server | out-file
    -Append D:\LEDetails.txt

    Select-String D:\LEDetails.txt -pattern
    “LoadEvaluatorName” | out-file -Append D:\LE.txt }

    Set-XAServerLoadEvaluator -ServerName $server Offline


    Let me know for any clarification.

  2. TrevorTrevor02-25-2012

    First of all, thanks so much for the scripts, they help so much especially with provisioning your xenapp. I have two farms and I will explain my experience so far.
    Running xenapp 5 I have seen the following steps which includes a 5 second window when the server LE is set back to default 5 seconds before the reboot command. This introduces a short window when users could login to a server that is going to restart very soon. Wouldn’t it be better to set it to Nologon, check for logons, initiate reboot, and then set LE back to default? I understand that the load is high and then comes down after all the startup work is done, but this 5 second window is a chance for a user to be disconnected from their session defeating the entire reason for a no-impact script. Am I missing something here? I am still using the script because its unlikely a user would connect to that particular server in that 5 second window.
    On my XenApp 6.5 farm so far I did have a server reboot but it didn’t return back to allow logons automatically. This may not be the script’s issue, but the server is provisioned like the rest. This caused the whole process to stop and left the server in “no logons until reboot” state. I changed the task to kill the process after running for 3 days to maybe avoid this issue since the script will start again. Would it be possible to retry the restart command if it doesn’t return to “allow logins” within x minutes? I’m still using the script because its nice!

  3. JasonJason02-02-2012

    Is there any way to specify a list of servers that will be rebooted, rather than enumerating the farm?

    I’d like to use this script on a specific group of servers.

    I have tried putting all bar these servers in the exclusion list, but that didn’t seem to work as when I ran a test, it applied the Reboot LE to the server it was running on – Even though it was in the list.

    So I’d like to just have an explicit list of servers to reboot.

    • Robert SkinnerRobert Skinner03-01-2012

      This would be a great feature. In our farm, we would like to run the script on differnt schedule and cycle for differnt groups of servers. In some cases have sereral groups of serfers rebooting.

  4. Matthew PMatthew P01-25-2012

    Great Script, Works and fixes a big problem I have been having with my PVS cache disk filling up with junk in the pagefile and needing a reboot (also now fixed with a static size).

    Are you able to build in the logic to send an email alert with each step that completed along with the event log entry

    i.e, the email will have the server name, the time and date the LE was assigned, when the server was reboted, when it refelected as up again etc etc (am sure i missed some logs)

    This would be helpfull to send to our service desk so they know which servers reboted etc without having to monitor event logs etc, and could identify any issues that arise after or from the reboots like hung servers etc.

    Keep up the good work

    p.s have you got a mailing list or just twitter to follow for updates to the scripts

  5. Jeff DemarcJeff Demarc01-18-2012

    Excellent script, few suggestions:

    a) Support to process worker group(s) in XenApp 6.0/6.5

    b) Ability to preserve logon prohibited status is enabled after reboot in XenApp 6.0/6.0 (change logon /disable)

    c) Ability to allow a given number of servers to fail on the reboot and still continue to run the script (for larger farms)

    d) Ability to log to a custom eventview log

1 4 5 6 7 8 25

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