Contents

Take XenApp Server “offline”

Website Visitors:
Contents

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

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.

Script

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13

$server = $Args[0]
$servicestatus = (Get-WmiObject -computer $server Win32_Service -Filter "name='IMAservice'").state
if ($servicestatus -eq "Running")
{
	$newLM = New-Object -comobject CPSCOMInterop.CPSLoadManager.1
	#remove server from LB
	$returnvalue = $newLM.SetServerLMState($server,0)
}
else
{
	write-host "$server's IMA service is not running, it can be moved off LB table"
}	

Posted in Citrix Community

Want to learn more on Citrix Automations and solutions???

Subscribe to get our latest content by email.

If you like our content, please support us by sponsoring on GitHub below: