The purpose of this article is to summarize the different ways an administrator can use to take a XenApp server offline for maintenance.
TS Server Drain Mode was introduced in Windows Server 2008 and when the server is switched to Drain Mode, it does not accept any new connections but it will allow currently logged on users to reconnect to their existing sessions. By waiting for existing users to save their work and log off, the administrator can take a terminal server down for maintenance without causing user data loss. Drain mode also allows server admins to connect to the console session – using “mstsc /admin”.
Administrators responsible for enterprise environments that is shared by multiple users will find the functionality of drain mode maitenance as very important feature. The most common scenario when drain mode maitenance can be used is when a single server is hosting applications for multiple users. Using this feature administrator can leave existing sessions active, including the ability to reconnection to disconnected sessions but block or redirect all new incoming requests to another servers hosting the same resources. Once all existing sessions are closed administrator can start maitenance tasks.
XenApp maintenance methods
Server administrators can put XenApp server in maintenance mode using:
Windows Remote Desktop Services options
Server administrator can manage incomming sessions using change logon command. This method can be used only when server is online. Logon mode for RDP is per-server configuration that is stored in registry in two different locations:
0 = Allow all connections
1 = Allow reconnections, but prevent new logon until reboot
2 = Allow reconnections, but prevent new logon
0 = Enabled
1 = Disabled
Available change logon switches are the following:
XenApp Logon control options
Citrix strongly recommends that you use these method instead of the Windows Remote Desktop Services options to control logons to XenApp servers.
Prior to version XenApp 6.5 the most common method was to use Custom Load Evaluator that will report a full load when assigned to a server. The main reasons to use Load Evaluator were:
- Load Evaluator assigment is stored in data store, so Load Evaluator can be assigned to a server, even while server is offline.
- Load Evaluator will reject new sessions, but it will allow user to reconect to disconnected session
- Load Evaluator will affect only ICA sessions and RDP connection will still be allowed
In XenApp version 6.5 ability to directly assign Load Evaluator to specific servers was removed, instead Load Evaluator can be assigned to the Worker Group (Worker Groups are collections of XenApp servers, residing in the same farm, that are managed as a single unit). The ability to put a single server into maitenance mode is provided by logon mode control.
By default, logons are enabled for each server in a farm, allowing connections, reconnections, and session sharing. Before taking a server offline, such as for maintenance, use these options to reroute logons to other servers.
- Allow logons and reconnections. Enable all logons, reconnections, and session sharing (default setting).
- Prohibit logons and reconnections. Reroute all logons, reconnections, and session sharing to other servers.
- Prohibit logons only. Reroute new connections and session sharing, but allowing users to reconnect to disconnected sessions. This state persists until you change it manually.
- Prohibit logons until server restart. Reroute new connections and session sharing, as above, but after restarting the server, the setting automatically changes back to Allow logons and reconnections.
XenApp logon control is actually managed through data store and is updated on target host using LHC synchronization (Local Host Cache). When system administrator change the logon mode in console, this change is actually not immediately done in the registry of the target machine. Behavior will be different based on the server status:
- XenApp server is online – server will get notification using the normal LHC synchronization interval.
- XenApp server is offline – server will get notification from data store during boot and automatically apply the logon mode that was configured in the console. This allow to change logon mode, even while server is offline.
Administrators responsible for large and dynamic enterprise environments, will look for methods to automate the XenApp server maintenance process. To fully manage and automate assignment of logon modes, there are two commands that can be used:
To get logon mode assigned to server, it’s one of the properties of the regular server object:
$(Get-XAServer -ServerName $Server).LogonMode
To assign logon mode to server:
Set-XAServerLogOnMode -LogOnMode $LogonMode -ServerName $Server
Values allowed for $LogonMode are the following:
Important items to remamber:
- In XenApp versions prior to 6.5 usage of custom load evaluator was just a workaround to provide required functionality. Logon mode functionality availabe in version 6.5 is a wining option and there is no reason to use the old approach.
- System administrators still have RDP access to disabled servers to perform administrative tasks using mstsc /admin command.
- Since logon mode is managed through data store, it is possible to drain server, even while server is offline.