First published on CloudBlogs on Jun, 15 2007
When a terminal server needs maintenance, the administrator may want to prevent users from logging onto a server which is about to be taken offline. In Windows Server 2003 there was a command-line tool to disable all remote connections; however, this prevented users with disconnected sessions from reconnecting, causing them to lose their work. To address this issue, in Windows Server 2008, the TS Server Drain Mode prevents
users from logging onto the server, while allowing 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. Additionally, TS server drain mode is integrated with Session Broker Load Balancing, allowing one of the servers in a load balanced farm to be safely taken offline without any perceived change to end user experience or loss of service.
What is TS server drain mode?
In Windows Server 2008, when a Terminal Server is in
mode, remote logons for new users are disabled. Users with an existing session may reconnect (in order to save their work and logoff). Users without an existing session are prevented from logging on.
In a farm where Session Broker Load Balancing is deployed, users without an existing session are redirected to another server in the farm where they can logon. For servers not joined to a load balanced farm, if a user without an existing session connects remotely (i.e. attempts to logon), he will receive the error message shown below:
Additionally, there is an option to enable drain mode temporarily. When set, user logons are re-enabled automatically after restart. This option is convenient for applying simple patches that only require a single reboot.
While a server is in drain mode, administrators may still log on to the physical console or remotely log on using the /admin or /console command-line option for MSTSC. This allows administrators to remotely maintain the Terminal Server.
How to put a terminal server into drain mode?
There are two ways an administrator can put a terminal server into drain mode: 1) using the command-line tool chglogon.exe, or 2) using Terminal Services Configuration UI.
1. Command-line settings
The command-line tool chglogon.exe (or “change logon”) may be used to configure the drain mode. There are five options: /QUERY, /ENABLE, /DISABLE, /DRAIN, /DRAINUNTILRESTART, as shown in the following screen shot:
By default, all connections are allowed on a terminal server. To configure a server into drain mode, use the /DRAIN option.
To configure a server into drain mode temporarily, use the /DRAINUNTILRESTART option. After restart, user logons will automatically be re-enabled:
To take the server out of drain mode and restore connectivity, use the /ENABLE option:
The “chglogon /DISABLE” command has the same behavior as in Windows Server 2003 – no remote connections will be allowed, even if a user has an existing session.
2. Terminal Services Configuration UI
Terminal Services Configuration UI (Administrative Tools -> Terminal Services -> Terminal Services Configuration) is the other way to configure TS server drain settings:
The UI shows the current status of the drain mode. Double-clicking “Terminal Server Drain Mode” brings up another dialog box:
The three settings listed are defined as follows:
“Allow new user logons” – All remote connections are allowed
“Deny new user logons” – Terminal Server is in drain mode
“Deny new user logons until restart” – Terminal Server is in drain mode until the server is restarted
: The settings are changing slightly:
“Allow all connections” – All remote connections are allowed
“Allow reconnections, but prevent new logons” – Terminal Server is in drain mode
“Allow reconnections, but prevent new logons until the server is restarted” – Terminal Server is in drain mode until the server is restarted
Also, the above blog post is accurate for Longhorn Server Beta3. There is a minor change for RC1 in the TsConfig UI – now the drain mode is called "user logon mode".