Patching Lync Server 2013 Frontends

We finally implemented a complete HA solution at work for Lync Server 2013. This includes three frontend servers. This allows us to perform maintenance on the frontends with very little end user impact. When applying Windows Updates to Lync Server 2013, you should always follow Microsoft’s advice at this article. Having said that, here are a couple powershell commands you can use to make stopping the services on the frontends easier.

Perform the following steps after issuing the command Get-CsPoolUpgradeReadinessState and following Microsoft’s recommendations.

  1. The first command allows you to set all services into a manual startup state. This is necessary in case a server needs to be rebooted multiple times to apply updates.
    Get-CsWindowsService | Set-Service -StartupType Manual
  2. Next, stop all the services gracefully. This allows steady draining of connections.
    Stop-CsWindowsService Graceful
  3. Apply all the updates you need and reboot as necessary. If you have a three frontend setup, you can keep one frontend down for as long as necessary, provided neither of the other two fail.*
  4. Once all updates are applied, start the services.
    Start-CsWindowsService
  5. Now, we can set the services back to delayed automatic startup.
    Get-CsWindowsService | %{"sc.exe config " + $_.Name + " start= delayed-auto" | Invoke-Expression}
    Note that the above command is a bit more complex than the counterpart that sets all services into manual mode. This is because the Set-Service cmdlet doesn’t have functionality for delayed automatic startup.

I hope that helps. I found it was going to be tedious opening the services MMC and setting each service to manual individually and reversing that.

* In Microsoft’s Lync Server supported topologies article, it is noted that in a three server farm, if the number of frontends drops below two, the remaining frontend goes into survivability mode and stops Lync services after five minutes. Keep that in mind when planning maintenance.