Monday, May 9, 2016

Lync Server 2013 patching guide


Lync Server 2013 Patching Guide

This Post will describe you the process to update Lync servers to latest cumulative updates.


Phase 1     Front-End and director Servers


1.0     Checking The Server


Check each Lync server in Enterprise Pool for Below points.

1.1    Verify Event viewer and Pending Reboots

Event ID 1029 will be logged in the application log if an application has been installed that requires a restart.

Run Below Commands in Powershell to view if there is pending reboot on Server

$rebootreqevents = get-eventlog -log application |where {$_.instanceID -eq "1029"}
$rebootreqevents


Check the first entries date and time. In this case it is Jan 11 20:32

Now run the following commands from powershell

$lastboot = Get-WmiObject -Class Win32_OperatingSystem
write-host "Last Server Reboot:`t" $lastboot.ConvertToDateTime($lastboot.LastBootUpTime)

You will get the following output
Please make sure Server is rebooted after last pending Reboot date.

1.2    Copy Lync Update Installer on local drive.

Copy the patches that have been downloaded to each server to be patched.
The core reason for this logic is that then during each install a set of logs per server will get generated when applying the patch, if the installer is run from a central share the logs will be overwritten each time and will make it difficult to troubleshoot.

1.3    Please Refer Below Flowchart for Upgrade Process





2.0    Preparing server for Upgrade

Step 1.

    On a Front End Server in the pool, run the following cmdlet:
Get-CsPoolUpgradeReadinessState
Sample Output: -

If the State value of the pool is Busy, wait for 10 minutes, Run command again.
If you see Busy for at least three consecutive times after you wait 10 minutes in between each attempt, or if you see any result of InsufficientActiveFrontEnds for the State value of the pool, there is an issue with the pool.
Do Not Proceed with patching in this case.
If the State value of the pool is Ready, go to step 2.



Step 2.   

The Get-CsPoolUpgradeReadinessState cmdlet also returns information about the upgrade domains in the pool, and about which front-end servers are in each upgrade domain.
If the ISReadyforUpgrade value for the upgrade domain that contains the server that you want to upgrade is True, you can upgrade the server. Go to step 3

Step 3.


Run Following command to check windows fabric.

Get-CsPoolFabricState -PoolFqdn "<name of the pool>"

Make sure all members of pool are mentioned in each service viz. MCU factory; Conference Directory; Routing; Lync 2015 Storage Service.
And make sure all of the routing groups have a primary and at least one secondary.


Step 4   

Stopping Lync Services (Draining Server)
The follow are the steps required to take to drain a Lync server before any patching cycle begins
Draining a server is a good way to minimize disruptions but it must be noted that some disruption will occur, Server draining only allows calls that are currently active to stay up and running until they terminate. This does not apply for other areas in the lync client. The client will after a small period of time log back into another server and operate as normally. But you can imagine doing a patch cycle on all servers and moving users from one server to another (if it happens to be round robin) could lead to disruption for the user.

Run Following Command in PowerShell (run as Admin).

stop-cswindowsservice –graceful

Check If all services have been stopped by running following command:
Get-CsWindowsservice

PS: Once a server is patched and rebooted it will automatically start the services again.



3.0    Patching Server


3.1    Installing Lync update on Server

Navigate to the local copy of the patch and double click Lync update installer
In our case, Lync update installer have been placed in D:\Lync Updates. (IN Geo)

Run Installer, following screen should appear




Notice the column Latest Installed and observe which patches have a Green Check Circle (i.e. it has the latest patch installed for that component) or a Red X Circle (i.e. it does not have the latest patch installed for that component).

NOTE: Having mixed results for the “latest” patches is normal; the latest released patches may not update all components in the system.

When you are ready to start the patching process, Click Install Updates.
This will begin the patch process which is automated from here. Monitor the deployment to ensure all goes successfully.

Once the process has complete the installer screen will have updated itself if the patches have been installed successfully.
Once the updates have been installed, restart the server if prompted to do so.

3.2     Making sure if Updates are installed

After restart, check if all services are up and running by running following command in PowerShell.
Get-CsWindowsService
If all services are running,
Run Lync update installer again and check if last column has all greens check circles. (refer screenshot above)

3.5    Enable the Mobility service


To enable the Mobility service, run the following cmdlet:
Enable-CsTopology

3.6    Enable the Unified Communications Web API

To enable the Unified Communications Web API (UCWA), you must run the Bootstrapper.exe tool again on all Lync Server 2013 Director servers, Standard Edition servers, and Enterprise Edition front-end servers on which the web components are installed and updated. The command to run the tool is as follows:
%ProgramFiles%\Microsoft Lync Server 2013\Deployment\Bootstrapper.exe




Phase 2    Backend Servers


Note that If a Back End Server is down for at least 30 minutes while you are upgrading it, users may then go into resiliency mode. When the upgrade is finished and the Back End Servers has again connected with the Front End Servers in the pool, users are returned to full functionality. If the upgrade takes less than 30 minutes, users will not be affected.

2.1 Upgrading backend Servers in Lync enterprise edition pool

We will take a case where SQL database are mirrored.

2.1.1 verifying Database mirror state

Before starting update, make sure all the Database should be principle on primary server.
To check Database mirror state, use following command:
  1. Get-CSDatabaseMirrorState –poolfqdn <Pool FQDN> -databasetype user
  2. Get-CSDatabaseMirrorState –poolfqdn <Pool FQDN> -databasetype application
  3. Get-CSDatabaseMirrorState –poolfqdn <Pool FQDN> -databasetype centralmgmt
Sample Output
In all three outputs, you need to check whether StateOnPrimary is principal.
If any of database seems to Mirror for StateOnPrimary, then you need to failover database to primary.
You failover database to primary, use following command:
  1. Invoke-CSDatabaseFailover –poolfqdn <Pool FQDN> -newprincipal primary -databasetype user
  2. Invoke-CSDatabaseFailover –poolfqdn <Pool FQDN> -newprincipal primary -databasetype user
  3. Invoke-CSDatabaseFailover –poolfqdn <Pool FQDN> -newprincipal primary -databasetype user




2.1.2 Updating Backend database

Apply the changes made to SQL database by running following command in Lync Management shell
  1. If this is an Enterprise Edition Back End Server and there are no collocated databases on this server, such as Archiving or Monitoring databases, then type the following at a command line:
Install-CsDatabase -Update -ConfiguredDatabases -SqlServerFqdn <SQL Server FQDN>
  1. If this is an Enterprise Edition Back End Server and there are collocated databases on this server, then type the following at a command line:
Install-CsDatabase -Update -ConfiguredDatabases -SqlServerFqdn <SQL Server FQDN>  -ExcludeCollocatedStores


2.2    Verifying The Database Updates


Check each server for versions to be up to date by running following command on Front-End Server by replacing server name with each backend server.

Test-CsDatabase -ConfiguredDatabases -SqlServerFqdn servername.domain.com | FT DatabaseName, ExpectedVersion, Installedversion

Sample Output: -





Phase 3    Monitoring/Archiving, Edge, Mediation Servers


1.0    Checking The Server

Check each Lync server in Enterprise Pool for Below points.

1.1    Verify Event viewer and Pending Reboots

Event ID 1029 will be logged in the application log if an application has been installed that requires a restart.

Run Below Commands in Powershell to view if there is pending reboot on Server

$rebootreqevents = get-eventlog -log application |where {$_.instanceID -eq "1029"}
$rebootreqevents


Check the first entries date and time. In this case it is Jan 11 20:32

Now run the following commands from powershell

$lastboot = Get-WmiObject -Class Win32_OperatingSystem
write-host "Last Server Reboot:`t" $lastboot.ConvertToDateTime($lastboot.LastBootUpTime)

You will get the following output
Please make sure Server is rebooted after last pending Reboot date.

1.2    Copy Lync Update Installer on local drive.

Copy the patches that have been downloaded to each server to be patched.
The core reason for this logic is that then during each install a set of logs per server will get generated when applying the patch, if the installer is run from a central share the logs will be overwritten each time and will make it difficult to troubleshoot.

1.3     Check Lync services

Check all Lync/SQL services are up and running each Server in one pool.
Run Following Command in PowerShell, run as admin
Run-CsWindowsService

If services are up and running on all servers in one pool, Open Lync update installer on one of the server,

2.0    Updating the Server

Navigate to the local copy of the patch and double click Lync update installer
In our case, Lync update installer have been placed in D:\Lync Updates. (IN Geo)

Run Installer, following screen should appear


When you are ready to start the patching process, Click Install Updates.
Once the updates have been installed, restart the server if prompted to do so.

3.0    Making sure if Updates are installed

After restart, check if all services are up and running by running following command in PowerShell.
Get-CsWindowsService
If all services are running,
Run Lync update installer again and check if last column has all greens check circles.
Then go for Second server in each pool/domain.

4.0 Installing update on Monitoring /archiving database

Apply the changes made to SQL database by running following command in Lync Management shell
Install-CsDatabase -Update -ConfiguredDatabases -SqlServerFqdn <SQL Server FQDN>

Where SQLserverfqdn is Monitoring SQL server’s fqdn.

5.0 Verifying Database update changes

Check for versions to be up to date by running following command on Front-End Server by replacing server name with monitoring server.

Test-CsDatabase -ConfiguredDatabases -SqlServerFqdn servername.domain.com

Sample Output: -





-------------------------------------------END------------------------------------------------

No comments:

Post a Comment