There are going to be times when you need to patch or perform other maintenance on your Lync servers. A question that I often get asked by customers is, "How can I perform maintenance on my Lync servers without disrupting users?" Unfortunately, there's always going to be some disruption because the Front End Server has to process real-time workloads, such as conference call, IM, Presence, and Enterprise Voice workloads. In "Microsoft Lync Server 2013 Front End Maintenance," I discuss one best practice for minimizing the service interruption for your users. Let's take a look at another best practice: server draining.

Server Draining Prerequisites

There are two prerequisites to server draining, the first of which is having Lync clients. Lync clients are needed to understand the action initiated by the Lync server. You need to have Lync 2013 or Lync 2010 clients connected to Lync Server 2013. Clients prior to Lync 2010 won't understand the server draining action and therefore won't behave as expected.

The second prerequisite is DNS load balancing for the Lync servers that are deployed. You might be wondering, "Is having DNS load balancing a must?" It's not a "must" but it's strongly recommended due to how hardware load balancers work. Hardware load balancing isn't application-aware. This means that when the Front End Server is no longer accepting connections for media, the Lync server ports aren't shut off. Therefore, the hardware load balancer can still send connection requests to that particular Front End Server.

Once these prerequisites are met, you can drain the server so that you can perform the maintenance. Here are the steps:

  1. Check the status of the Lync services on a Front End Server.
  2. Drain the server.
  3. Recheck the status of the services.
  4. Perform the maintenance and resume the services.

You can use the cmdlets in the Lync Server Management Shell to perform these steps.

Step 1: Check the Service Status

You can use the Get-CsWindowsService cmdlet to check the current status of the Lync services on your Front End Server. For example, if you want to check the status of the services on the local computer, you can run the command:


​Figure 1 shows sample results. In this case, there's one conference call that's currently running on this particular Front End Server.

Figure 1: Checking the Status of the Lync Services

As Figure 2 shows, this conference call only has one participant. Despite this, it's still considered a conference call because it's registered as a conferencing multipoint control unit (MCU) session.

Figure 2: Confirming the Active Conference Call

Step 2: Drain the Server

The next step is to drain the server. To do this, you can use the Stop-CsWindowsService cmdlet with the
-Graceful parameter:

                              Stop-CsWindowsService –Graceful

The –Graceful parameter tells Lync to continue all existing service requests but reject any new ones.

Step 3: Check the Service Status Again

At this point, you can run the Get-CsWindowsService cmdlet again to see which services have stopped and which services are still active. As Figure 3 shows, the one-person conference call is still active and marked as Draining. All the services related to that conference call are also marked as Draining.

Figure 3: Rechecking the Status of the Lync Services

All the other services have been stopped, including the RTCSRV service. RTCSRV is the key service for registered Lync users. Once it has stopped, existing connections for logged-on users will be stopped and redirected to another Front End Server. So when you perform maintenance, there will be some user disruption, even with server draining. That's due to the RTCSRV service stopping and users being disconnected and reconnected to a different Front End Server.

To take a closer look at what is happening, you can view the Lync services in Control Panel. As Figure 4 shows, the services that are draining are in a Paused state, which means that there are still connections persistent to those services.

Figure 4: Viewing the Lync Services in Control Panel

You can use the Windows Event Viewer to see what is happening to services that are draining. When the draining is complete for a service, you'll see event ID 33018. When the service has stopped, you'll see event ID 33004. Event ID 33019 indicates that a new service request for the Front End Server being drained has been redirected to another Front End Server. Figure 5 shows this event.

Figure 5: Logging Event ID 33019 When a Service Request Is Redirected

After all the connections to the Front End Server have been dropped, you can use the Get-CsWindowsService cmdlet again to make sure that all services have been stopped.

Step 4: Perform the Maintenance and Resume the Services

Once you're certain that all the services have been stopped, you can perform the maintenance. When the maintenance is completed, you can resume the services on the Front End Server by either rebooting it or by running the command:


You can use the Get-CsWindowsService cmdlet once last time to make sure that all the services are running, as Figure 6 shows.

Figure 6: Making Sure All the Services Are Running After the Maintenance Is Performed

What Users Experience During Server Draining

You've seen what happens on the server side during draining. Now let's explore what Lync users experience during the draining process.

Because the RTCSRV service stopped, Lync clients will lose Session Initiation Protocol (SIP) connections to the Front End Server. As a result, users will be signed out of the Lync client, as seen in Figure 7.

Figure 7: Being Signed Out of the Lync Client

However, any active calls and conference calls will remain active. This is evident if you look at the call length indicator. In Figure 2, the call length indicator in the top right corner indicates that the conference call was at the 3:28 minute mark. In Figure 7, the conference call is at 16:23 minute mark. Thus, this call has remained active despite the RTCSRV service being stopped.

The active calls and conference calls will have limited functionality, though, as the disclaimer at the bottom of Figure 7 mentions. Users won't be able to use any advanced features (e.g., inviting other Lync users to join a conference call) until those calls are established on a different Front End Server.

More to Draining Than Meets the Eye

There's a misconception that users won't experience any disruption when servers are drained. As you saw, that's not the case. There's some disruption, but it's minimal.