Anyone who has updated a Lync environment with a recent Cumulative Update knows that there are often manual steps to perform after the LyncServerUpdateInstaller.exe program is finished. These are often database update functions. And often, multiple functions to update the various different databases, including the CMS, monitoring, archiving, Persistent Chat, etc. I’ve run across quite a few environments where the LyncServerUpdateInstaller.exe is run, and nothing else is done, and the client can’t figure out why things aren’t running as they expect. Fortunately, the Test-CsDatabase cmdlet will show you the current version of the database and the expected version. But then you have to manually compare each one to determine if an update is required. Of course, there are databases on the local Front End server(s), and the SQL backend server(s). Also, it’s important to review the status of SQL mirroring, and ensuring that databases are active on the principal node and not the mirror node. And that’s just part of the patching process.
Dave Howe, of the Lync product group, and I collaborated on a script that helps streamline part of this process. Dave did a lot of the initial grunt work, so he deserves a lot of the credit. I cleaned things up and optimized per some best practices.
Among the tasks that this script performs:
Determines whether database updates are required. It performs the following checks:
- Detects whether the pool version is Lync Server 2013 or later
- Detects whether database mirroring is enabled
- Detects whether the primary and mirror SQL servers are online
- Detects whether the mirror server is principal for any databases
- Detects whether the local machine is a FE of the given pool
- Detects whether the CMS is on Lync Server 2013 or later
And returns the following info:
- Returns list of local databases, their versions, and whether a database update is required (if the local server is a member of the pool)
- Returns list of backend databases, their versions, and whether a database update is required
- Returns list of CMS databases, their versions, and whether a database update is required
An example output is shown below. Note that the local XDS database requires an update
Get-CsDatabaseUpdateStatus.ps1 [[-PoolFqdn] ] [-WhatIf] [-Confirm] 
Execution Policy: Third-party PowerShell scripts may require that the PowerShell Execution Policy be set to either AllSigned, RemoteSigned, or Unrestricted. The default is Restricted, which prevents scripts – even code signed scripts – from running. For more information about setting your Execution Policy, see Using the Set-ExecutionPolicy Cmdlet.
v1.1 – 04-30-2014 – Get-CsDatabaseUpdateStatus.v1.1.zip
v1.0 – 04-30-2014 – Get-CsDatabaseUpdateStatus.v1.0.zip
See the changelog for information on what’s changed/included in each version.