Take XenApp Server "offline" to troubleshoot
A PowerShell script enables the XenApp administrator to take any XenApp server "offline" to troubleshoot. The current sessions on the server will not be affected and new sessions will not be routed to it.
Description
XenApp administrators often encounter a situation which requires to take the XenApp Server "offline" to be troubleshooted. By "offline", it means the server should not take any more new sessions while keep the existing session untouched.
Usually the administrator will use either the script or AMC to disable the logon of the server so no more sessions can be launched against that server. But disable logon also disable the capability of the remote login to the server to troubleshoot even using RDP protocol.
A better approach will be take the server off from the load balancing table so no new user sessions will be routed to this server while still keeping the server accessible from both ICA and RDP direct connection. Currently, the HMR service will offer some kind of help since one of its action while certain HMR tests failed is removed the server from the load balance table. But this approach does not give the administrator the freedom to take any specific server off the load balance table. The server must fail certain HMR test to be taken off the load balance table. This requires the administrator to write an extensively large number of HMR tests to accommodate different situations. This will put the server under the stress of running large number of HMR tests.
The best approach will be that a program be written to can take any server "offline" as the administrators see fit to give the administrator instant control of troubleshooting while not affect the overall farm performance.
Such program is available now. It is written in PowerShell and give the administrator the capability to take any server in the farm off the load balance table. And he/she can use the built in Enablelb.exe utility to put the server back to load balance table if the server is deemed able to serve new sessions.
Usage: ./move_server_off_lb_table.ps1 <XenAppServerName>
When running the script, the administrators proivde the script the name of the server that you wish to be taken offline (this script is required to be run on XenApp server). The script will first check if the server's IMA service is still running. If the server's IMA service is stopped, it will not perform any action since at this time the server will be off from the load balance table already. It the server's IMA service is still running, it will take the server off the load balance table immdetiatly.
Download
http://community.citrix.com/download/attachments/37388904/move_server_off_lb_table.ps1
Code Snippet
Please any code snippet which might be useful for the user to better understand the script.
Disclaimer
These software applications are provided to you as is with no representations, warranties or conditions of any kind. You may use and distribute it at your own risk. CITRIX DISCLAIMS ALL WARRANTIES WHATSOEVER, EXPRESS, IMPLIED, WRITTEN, ORAL OR STATUTORY, INCLUDING WITHOUT LIMITATION WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NONINFRINGEMENT. Without limiting the generality of the foregoing, you acknowledge and agree that (a) the software application may exhibit errors, design flaws or other problems, possibly resulting in loss of data or damage to property; (b) it may not be possible to make the software application fully functional; and (c) Citrix may, without notice or liability to you, cease to make available the current version and/or any future versions of the software application. In no event should the code be used to support of ultra-hazardous activities, including but not limited to life support or blasting activities. NEITHER CITRIX NOR ITS AFFILIATES OR AGENTS WILL BE LIABLE, UNDER BREACH OF CONTRACT OR ANY OTHER THEORY OF LIABILITY, FOR ANY DAMAGES WHATSOEVER ARISING FROM USE OF THE SOFTWARE APPLICATION, INCLUDING WITHOUT LIMITATION DIRECT, SPECIAL, INCIDENTAL, PUNITIVE, CONSEQUENTIAL OR OTHER DAMAGES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. You agree to indemnify and defend Citrix against any and all claims arising from your use, modification or distribution of the code.
Comments (9)
Jul 17, 2008
Anonymous says:
Sorry if this is a stupid question, but wow do I get the COM object, CPSCOMInter...Sorry if this is a stupid question, but wow do I get the COM object, CPSCOMInterop.CPSLoadManager, installed on my machine?
Jul 17, 2008
Andy Zhu says:
As long as you have Presentation Server 4.5 installed, you should be able to fin...As long as you have Presentation Server 4.5 installed, you should be able to find that COM object on the CPS server
Jul 21, 2008
Nicholas Dille says:
I have updated my series about CPSCOM with a new article to include information ...I have updated my series about CPSCOM with a new article to include information about these interfaces.
But I am rather confused whether or not CPSCOM is for public use now that such a script is published. Vishal states here that we are to wait for the PowerShell-based SDK. I have expressed my concerns about the situation in the latest article.
Regards,
Nicholas, http://blogs.sepago.de/nicholas/.
Sep 04, 2008
Anonymous says:
This looks like a helpful utility, but the download link directs to a page not f...This looks like a helpful utility, but the download link directs to a page not found error.
Sep 04, 2008
Andy Zhu says:
The download link is updated. Thx for pointing out the error.The download link is updated. Thx for pointing out the error.
Sep 30, 2008
Atle Lund says:
What about just having a custom load evaluator with "scheduling" set to never be...What about just having a custom load evaluator with "scheduling" set to never be available, apply this when you want to have it "offline" without affecting the logged on users? Or am I missing something?
Regards,
Atle
Jan 12, 2009
Anonymous says:
Does this Powershell script work for PS 4.0 Citrix servers?? Thank you, TomDoes this Powershell script work for PS 4.0 Citrix servers??
Thank you, Tom
Jan 13, 2009
Vishal Ganeriwala says:
yes it should workyes it should work
May 05, 2009
Anonymous says:
great code, thanks. how can I change the code to move XenApp server online? curr...great code, thanks.
how can I change the code to move XenApp server online?
currently, only restart will bring it online again.
Add Comment