Home > Lync Server > Script: Get-CsDatabaseUpdateStatus.ps1 – See If Your Lync Databases Are Up To Date

Script: Get-CsDatabaseUpdateStatus.ps1 – See If Your Lync Databases Are Up To Date

Description

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:

  1. Detects whether the pool version is Lync Server 2013 or later
  2. Detects whether database mirroring is enabled
  3. Detects whether the primary and mirror SQL servers are online
  4. Detects whether the mirror server is principal for any databases
  5. Detects whether the local machine is a FE of the given pool
  6. Detects whether the CMS is on Lync Server 2013 or later

And returns the following info:

  1. Returns list of local databases, their versions, and whether a database update is required (if the local server is a member of the pool)
  2. Returns list of backend databases, their versions, and whether a database update is required
  3. 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-CsDatabaseUpdateStatus2

Syntax

Get-CsDatabaseUpdateStatus.ps1 [[-PoolFqdn] ] [-WhatIf] [-Confirm] []

Installation

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.

Assumptions

None

Download

v1.1 – 04-30-2014 – Get-CsDatabaseUpdateStatus.v1.1.zip

v1.0 – 04-30-2014 – Get-CsDatabaseUpdateStatus.v1.0.zip

Changelog

See the changelog for information on what’s changed/included in each version.

 

  1. April 30, 2014 at 1:56 pm | #1

    I get :
    At C:\Users\admin-ten\Get-CsDatabaseUpdateStatus.ps1:69 char:2
    + param()
    + ~~~~~~~
    The param statement cannot be used if arguments were specified in the function
    declaration.

    • Pat Richard
      May 1, 2014 at 9:48 am | #2

      Download v1.1

  2. David Taig
    May 7, 2014 at 11:14 am | #3

    For the example above, you need to apply the Central Management Database update for xds

    Install-CsDatabase -CentralManagementDatabase -SqlServerFqdn CMS.FQDN -SqlInstanceName DBInstanceName -Verbose

    Ref: http://support.microsoft.com/kb/2809243

    • Pat Richard
      May 7, 2014 at 11:16 am | #4

      Yep, I know. Intentionally left it not updated so I could grab the screenshot.

  1. April 30, 2014 at 8:27 pm | #1
  2. May 7, 2014 at 3:52 am | #2
  3. August 6, 2014 at 7:26 pm | #3

Leave a Reply