Script: Get-CsDatabaseUpdateStatus.ps1 – See If Your Lync Databases Are Up To Date
Description
Anyone who has updated a Lync or Skype for Business environment with a recent Cumulative Update knows that there are often manual steps to perform after the LyncServerUpdateInstaller.exe/SkypeServerUpdateInstaller.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/SkypeServerUpdateInstaller.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, including Skype for Business
- 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, including Skype for Business
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
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.
Donations
I’ve never been one to really solicit donations for my work. My offerings are created because *I* need to solve a problem, and once I do, it makes sense to offer the results of my work to the public. I mean, let’s face it: I can’t be the only one with that particular issue, right? Quite often, to my surprise, I’m asked why I don’t have a “donate” button so people can donate a few bucks. I’ve never really put much thought into it. But those inquiries are coming more often now, so I’m yielding to them. If you’d like to donate, you can send a few bucks via PayPal at https://www.paypal.me/PatRichard. Money collected from that will go to the costs of my website (hosting and domain names), as well as to my home lab.
Assumptions
None
Download
v1.2 – 02-24-2018 – Get-CsDatabaseUpdateStatus.v1.2.zip
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.
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.
Download v1.1
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
Yep, I know. Intentionally left it not updated so I could grab the screenshot.
This scripts does not function with Lync 2010 server since the cmdlets it executing are 2013 cmdlets. Is there a 2010 version. what are my options?
It was not designed for 2010. It works for 2013 and later. I have no plans on supporting 2010 with this script. Sorry.
Hi Pat,
I have Ran this script it worked but it showed Update required No. I am going to update Cu5 on all the front end so once after the installation i have to run to verify whether it has some updates?
“No” means that no update is required based on the CU that’s already installed. Once you install CU5, it will show as “Yes” until you do the manual DB steps.
So I’m up to the August 2014 CU (5.0.8308.738) and all of my front ends show this…
rtcdyn 125.6.4 0.0.0 yes
I noticed the rtcdyn in your screenshot appears similar in terms of versions but does not indicate an update is required. Thoughts?
Hi Pat,
I get a strange line in the output:
local database: RTCDYN reports the expected version should be 125.6.5 but installedversion says: 0.0.0 and it marks it as UpdateRequired=YES.
I saw in your screenshot, that you also have installedversion as 0.0.0, but yours is not marked as require update. Is this normal to see 0.0.0 for that particular DB (thats the only one which has this 0.0.0 all others show normal-looking numbers) and how to decide if I need to update it or not? (for the record my example is from a Lync 2013 SE pool/server deployment with the 2014.12.31 update already run, including all the DB updates as well).
That’s a known issue with the last few CUs. MS is aware of it. The script is correctly reporting what the DB is configured as (0.0.0.0), but the update is already applied (assuming there was no errors during the DB updates).
Thanks, at least I know the triple 0 is as expected. I dont know though how should I update that RTCDYN so that the script marks as up-to-date. I run the update cmdlet couple of times, but no surprise the situation didnt change after.
You can’t really do anything about it. The version being reported is < than the expected version - so it's going to show as an update being required. And the version isn't stored as a string in the DB. It's essentially a construct.
Local Databases
DatabaseName ExpectedVersion InstalledVersion UpdateRequired
———— ————— —————- ————–
rtcdyn 125.6.5 0.0.0 yes
Central Management Databases:
DatabaseName ExpectedVersion InstalledVersion UpdateRequired
———— ————— —————- ————–
xds 10.13.3 10.13.1 yes
I got updaterequired “yes” for two databases after upgrading CU10 is it normal else how can I correct it?