Sunday, 13 October 2013

Lync 2013 / Skype for Business Call Pickup Group Manager Version 2

In Lync 2013 Cumulative Update 1 (February Update) Microsoft added the new call pickup group feature. Call pickup has been a classic voice feature since the very early days of PBXs. As a result, lots of businesses are still used to being able to answer other people’s calls by dialling special access codes from their phone. So it’s great that Lync finally has this capability to help ease some of the pain points for businesses transitioning from their previous traditional PBX systems to the new world.

Group Call Pickup Operation:

  • Calls coming in to any member of a call pickup group can be answered by dialling a special access code for that group. Note: the person wanting to answer the call will physically need to hear the other person’s phone ringing.
  • Any other user on the system can answer a call to a call pickup group by dialling the call pickup access code associated with that group. This feature does not restrict the call to only be answered by people in the group.
  • If there are multiple calls ringing on phones in the same group, the first call into the group is the call that will be answered when the access code is dialled. The other calls in the group will be queued in the order the calls came into the group after that.
  • Only direct calls to a user’s phone number can be answered with call pickup. (see limitations below for more details)


Call Pickup Groups in Lync 2013 have the following limitations:

  • Users can be assigned to only one call pickup group at a time.
  • Call pickup service uses the call park services running on the Lync front end server. When a call rings on a call pickup group user’s number it will simultaneously be automatically parked on the call park service. If the user picks up the phone the parked call is removed, or if the call pickup number used to answer the call, the user’s phone will stop ringing.
  • Calls into a call pickup group can be answered by any phone within the organisation, as long as the user wanting to pick up the call knows the correct access code to dial for that group.
  • Response group calls ringing on a call pickup group user’s phone cannot be answered via call pickup.
  • Delegate Calls – Calls delegated to another phone cannot be answered with call pickup.
  • Team Calls – Calls to users with team calling configured cannot be answered using a call pickup access code.
  • Simultaneous Ring Calls cannot be picked up with group call pickup.


Unfortunately, configuring call pickup groups has not been very easy to do (till now), due to Microsoft only giving access to configure call pickup groups through the very archaic SEFAUtil from the Lync Resource Kit (ResKit). This tool was originally designed to be used for administratively configuring Call Forwards and Team Calling by running commands from the prompt. SEFAUtil can check which call pickup group a user is in, or set which group a user in, via the command line.

A big problem with SEFAUtil (and also the Powershell commands in Skype for Business) is that it usually takes 2-5 seconds to check the settings for each user, and another 2-5 seconds to change their setting via the command line. In addition to this, you can’t directly query a call pickup group number to see which users are in that particular group. Instead, you have to query each user individually to establish the call pickup groups of which they are a member. If you think about that, for 1000 users it could take you (1000 x 5 seconds) well over an hour just to discover which groups all the users are in. This seems a little excessive to me.   

It’s time for a better way…


Lync 2013 Call Pickup Group Manager


So after many evenings in the lab scripting away, I have created a tool that will hopefully make life (when it comes to call pickup groups, at least), a bit easier. So what does it look like?



Features of Lync 2013 / Skype for Business Call Pickup Manager:
  • Works with both Lync 2013 using SEFAUtil or with Skype for Business CU1+ using Powershell commands.
  • View all call pickup group configuration (Orbits, Groups and Users) in one simple interface.
  • Call Pickup Group Manager discovers call pickup configuration information directly from the Lync / Skype for Business database. This avoids having to poll every user individually using SEFAUtil or Powershell to find their settings. This makes configuration discovery much faster than SEFAUtil or Powershell can offer in Lync 2013 or Skype for Business.
  • Easily Add, Edit or Delete Call Pickup Orbits.
  • Group-centric configuration of groups. ie. You can look up groups and see which users are in them rather than looking up each user individually to find their group assignment.
  • Multi-selectable user list boxes for adding or removing multiple users at once.
  • Use the "Find Selected User" button to find which group a user is assigned in.
  • Use the Filter button to reduce the user list to quickly find the user you want to add.

Updates

1.01 Update:
  • Pre-Req check will now look under the default reskit location on all available drives (not just C:)
  • If SEFAUTIL gives no response (due to an unknown error in SEFAUTIL) the tool will display an error to the user.
  • Added the Import-Module Lync command in case you run the script from regular Powershell or use the Right Click Run using Powershell method to start the script.
1.02 Update:

1.03 Common Area Phone Update:
  • This version has been updated to handle Common Area Phones. Some people reported errors being displayed by the tool when they had manually set (with SEFAUTIL) Group Call Pickup against Common Area Phones (ie. against the SIP URI of the Common Area Device, eg: sip:fbcb642b-f5bc-477a-a053-373aef4c00f8@domain.com). As of this version Common Area Phones will be included in the user list, and you can add and remove them from Call Pickup Groups.
  • User listboxes are now slightly wider to deal with the long SIP addresses of Common Area Phones.
  • When the tool loads it will display in the Powershell window the SIP Address and Display Name of all common area devices so you can match the (GUID looking) SIP address in the tool to the display name of the device.

1.04 Scalability Update:
  • Now supports window resizing.
  • Added Filter on Lync users listbox to cater for deployments that have lots of users.
  • Script is now signed.
1.05 Skype for Business Update:
  • Now checks that Group number matches a range that exists in one of the Call Pickup Orbits before allowing it to be added to the group list.
  • Up and Down keys in Orbit listbox now update orbit details properly.
  • You can now specify an alternate location of SEFAUTIL.exe in the command line. (Example: .\Lync2013CallPickupManager.1.05 "D:\folder\SEFAUTIL.exe")
  • Now checks the Skype for Business RESKIT location.
  • Put a dividing line between the Orbit creation section and the Group configuration section to try and indicate a divide between the two areas.
  • The Group list box label now displays the group name being listed up so the user understands better what group the user list is associated with.
2.00 Major Updates (11/4/2016):
  • When using Skype for Business the new Call Pickup Group Powershell commands (Available in Skype for Business CU1+) for user settings are detected and used instead of SEFAUTIL. This means you don't have to worry about any SEFAUTIL configuration anymore in Skype for Business CU1 or higher!
  • Unfortunately the Skype for Business Powershell commands have proved to be too slow for the discovery of all users Call Pickup Settings (because "Get-CsUser | Get-CsGroupPickupUserOrbit" has to iterate through all users taking about 2 seconds per user and takes ages). So I have retained and improved the direct SQL discovery method from version 1.0 for both Lync 2013 and Skype for Business.
  • Changed the way the Groups list box works. It now will be automatically filled with all the available groups from the Orbit ranges assigned in the system. If there is a user in a Group then it will be highlighted in Green text with Yellow background to help you find users without looking in empty groups.
  • When Orbits are added all the available groups will automatically be added to the available Groups list. Note: when you remove ranges that contain groups with users in them the group will no longer be accessible in the interface, however, the Pickup Group will still function. So make sure you remove users from groups before you delete the Orbit range.
  • Added a refresh button so the data can now be updated from the system whenever you want.
  • Improved the speed of looking through groups by re-architecting some of the code.
  • After a user is added or removed from a group the tool does not rescan all user's data again. Whilst this method always ensures the data being displayed is up to date, it's also much slower. This version is optimised for speed :)
  • Added pretty looking UP and DOWN arrow icons on add and remove buttons to try and clarify operation.
  • Added the "Find Selected User" button to find which group a user is assigned to.
  • Added help tool tips on buttons.
2.01 Enhancements
  • Added an export to CSV data to the app.
  • Fixed an issue with highlighting groups with users in them.
2.02 Update

  • Now supports Skype for Business 2019.



Available on the TechNet Gallery:

DOWNLOAD HERE



Prerequisites to use Call Pickup Group Manager


There are some important prerequisites that you need to use on both Lync 2013 and Skype for Business for the Call Pickup Group Manager to work properly.

Lync 2013 Prerequisites: 

  • Requires SEFAUtil installed on the system to Add, Remove, and Edit Call Pickup Settings.
  • Requires SQL Dynamic Ports opened in Windows Firewall on all Front End servers.

Skype for Business (CU1+)  Prerequisites

  • Skype for Business (CU1+) uses inbuilt Powershell commands to Add, Remove, and Edit Call Pickup settings (this is baked into the CU1 and above. So no additional installation is required.)
  • Requires SQL Dynamic Ports opened in Windows Firewall on all Front End servers.

Lync 2013 SEFAUtil Prerequisite

Under the hood, the Call Pickup Manager on Lync 2013 will use the SEFAUtil for adding and removing users from groups. This was a deliberate choice, as I wanted the tool to be supportable by Microsoft (ie. by avoiding any direct database editing, or hacking of things), and you don’t have to fear any unnecessary database corruption from using the tool.

Resource Kit Download

Download and install a copy of the Lync 2013 ResKit from here:

Make sure you have the ResKit installed on the Front End server you are running the Call Pickup Manger Tool on. I have written prerequisite checks into the tool, so you will get an error in the console window if it's missing.

SEFAUtil Configuration

Once the resource kit has been installed you need to configure Lync so it will trust the SEFAUtil tool. This allows the SEFAUtil to make UCMA calls to the Lync system.

Adding SEFAUtil as a trusted application:

Create a variable containing the site you will be configure SEFAUtil for:

$Site = Get-CsSite –Identity Melbourne

Configure the Trusted Application Pool:

New-CsTrustedApplicationPool –id pool.domain.com –Registrar pool.domain.com -site $Site.SiteId

Configure the Trusted Application:

New-CsTrustedApplication –ApplicationId sefautil –TrustedApplicationPoolFqdn pool.domain.com –Port 7489

Enable the Topology for the pool to start using the Trusted Application:

Enable-CsTopology

Here's the Technet explanation if you need it: http://technet.microsoft.com/en-us/library/jj945659.aspx



SQL Firewall Settings - Required for Lync 2013 and Skype for Business 


In order for the Call Pickup Manager to quickly download call pickup settings from your deployment, it needs access to your RTCLOCAL databases for each Front End pool. If you only have one Standard Edition server, then you can run the tool directly on this server and it will be able to access the RTCLOCAL database directly (note: this is also the case for an enterprise edition pool, but you need to run the tool on the first server in the Get-CsPool -> Computers property array, because this will be the database the tool tries to connect to). If you have multiple pools, the Call Pickup Manager will try and connect to each pool to download all the call pickup data for each pool (Branch SBA's also count as a separate pool).


In order for the SQL connection to be made (as shown in the diagram above), inbound connections to the SQL Browser Service and RTCLOCAL database will need to be allowed through the Windows firewall. These rules are not created automatically during Lync Server 2013 and Skype for Business Setup like most of the other rules are. So you will need to do this manually, by following the process below:

The Manual Method for Opening Firewall


You can add Firewall rules either through the Windows Firewall settings in Control Panel, or by the command line. In this example I will show you how to add the ports using the command line.

Step 1: Add the SQL Named Instance Browser with the following command:

netsh advfirewall firewall add rule name="Lync 2013 Call Pickup Manager - SQL Browser (UDP 1434)" dir=in action=allow protocol=UDP localport=1434 profile=domain

Step 2: Find the Dynamic TCP port used by the Named Instance (RTCLOCAL). Firstly, open the SQL Server Configuration Manager (On a Standard Edition server, this is installed when the local databases are deployed).

  1. Open SQL Server Configuration Manager
  2. (Select) Protocols for RTCLOCAL
  3. (Right Click) TCP/IP -> Select Properties
  4. (Select) IP Address Tab -> IPAll -> TCP Dynamic Ports

As you can see in the example below, for IPAll the TCP Dynamic Port is 49264. This is the Dynamic Port for this Named Instance that needs to be opened in the firewall.



Step 3: Add the Named Instances Dynamic Port via the following command (Substitute the Dynamic Port for your deployment in the highlighted area below):

netsh advfirewall firewall add rule name="Lync 2013 Call Pickup Manager - SQL RTCLOCAL Dynamic Port (TCP-in)" dir=in action=allow protocol=TCP localport=<Insertporthere> profile=domain


The Automated Method for Opening Firewall

If you are not fond of doing manual processes, you could just use the script below for opening the ports automatically on your remote Front End servers:


Download Open SQL Ports For Call Pickup Manager 1.00 Script here (also supplied in the tool zip):



Run this script on the server you want to open the SQL Browser and RTCLOCAL Dynamic TCP SQL ports on.

The Wrap Up


Once again, we’ve come to the end of another show. I hope you like my new tool and it makes your life a little easier. If you find any bugs or have any issues with it, please report them back to me so I can update the tool. Until next time, remember to answer your phone, and if you don’t, at least remember to get someone else to dial #110 to answer it for you. See ya next time!


Read more →

Saturday, 8 June 2013

Installing Lync 2013 Cumulative Updates with Mirrored Databases (CU1)

Overview


Update (CU2): With the release of Lync 2013 CU2 (July 2013) the upgrade process has changed from what is documented here. The new process in CU2 does not include the requirement to break the database mirror anymore. You do need to still ensure that the database servers are running on the Primary side before applying the Install-CsDatabase commands though. Please refer to the updated KB article here. There is a nice flow chart detailing the update process for front end servers here too.

There are now additional steps involved when running cumulative updates on Lync 2013 pools that have mirrored SQL databases. So I thought I would go into some detail about this new process and show how my Database Manager Tool can be used as part of this procedure. This post specifically covers the process documented for Lync 2013 CU1 (Feb 2013), however, it's likely the process will be similar for future cumulative updates. So this post should continue to function as a reference in the future, but be sure to always check the process documented for the specific CU you are installing before doing an upgrade.

The high level steps for this process are:
  1. Download and install the updates all of the Lync Servers.
  2. Run the Update Installer on all Lync Servers.
  3. Check that all of the databases are running on the Primary SQL server.
  4. Uninstall (remove) the database mirror for the Application database type.
  5. Install the schema updates on the Primary database.
  6. Recreate the database mirror for the Application Database type. This will recreate the Application databases back on the mirror server.
  7. Check the status of the database to see that they are all running correctly.
  8. (Optional) If your Monitoring backend databases are on a different server, update them now.
  9. Update the Central Management Database schema. (only if the database is on Lync 2013. If the CMD is on a Lync 2010 pool then you don’t do this)
  10. Enable the Mobility Service.
  11. Enable the UCWA service.
Note: the official process is on Technet here, please read it: http://support.microsoft.com/kb/2809243

The Process


Step 1: Download Update

The first step in upgrading Lync is downloading the CU1 Update installer from the Microsoft site: http://www.microsoft.com/en-us/download/details.aspx?id=36820

Step 2: Run the update on all Lync Servers

Run the CU1 Update Installer executable on all of your Lync Servers (one at a time, as the tool will take the services offline when updating them). The Updater will show you that all of your Lync services need updating:


This will take the services offline and upgrade them. After they are upgraded the Update Installer will show them as being the latest version with a green tick:


If you run your Lync Servers in this state (ie. Without updating the database schema) you might notice some strange errors being logged in the Event Viewer, for example:



The above error states that “There was a problem communicating with the Group Pickup backend database” (Event ID 31055). This is because the CU1 release has added the new Group Pickup feature, which requires new schema additions in the Lync SQL databases for storing the data for this feature.

Step 3: Check the current state of the SQL databases

When you’re not using mirrored databases this process is relatively simple, and can be achieved running one or two commands. However, when you’re using database mirroring there is a requirement to remove the mirror for specific databases that need to have the schema updated, and then re-create the mirror databases after the update has been applied to the primary database.

To remove the database mirror you will first need to ensure that all of your databases are running on the Primary SQL server. Using the database Lync 2013 Mirror Manager Tool you can do this as shown:


Note: The Lync 2013 Mirror Manager can be downloaded from here

If you have databases that are showing up in the Secondary column of the tool, then it means that they are running on the secondary SQL server and need to be moved back onto the primary SQL server (if you're running a witness server these database may have changed over to the secondary server without your knowledge). Move the databases back onto the primary simply by ticking all the check boxes in the Primary column and then click the Invoke button. You will then be prompted in the Powershell window about changing the databases back to the Primary server. Type “y” as a response to these questions. After this is complete the tool will update and the databases should all appear in the Primary column.

Note: In the above example I haven’t checked the status of the Persistent Chat Databases. In the real world you should actually do this at this point. However, for the purposes of this example I haven’t done this to show what effect it has later when running the Database Install commands.

Step 4: Remove the Database Mirror for the 'Application' database

We now need to remove the mirrored database configuration for the 'Application' database type.

Note: In the future the need to remove the database mirror for other database types may become a requirement as well. So if you are coming to this post for a newer CU update, please refer to the specifics of the KB article relating to your specific CU release.

Run the following command:

Uninstall-CsMirrorDatabase -DatabaseType Application -SqlServerFQDN DOMAINSQL001.domain.com -SqlInstanceName Lync2013 -DropExistingDatabasesOnMirror -Verbose

Here is an example of the command running:

PS > Uninstall-CsMirrorDatabase -DatabaseType Application -SqlServerFQDN DOMAINSQL001.domain.com -SqlInstanceName Lync2013 -DropExistingDatabasesOnMirror -Verbose
VERBOSE: Creating new log file
"C:\Users\Administrator.DOMAIN\AppData\Local\Temp\2\Uninstall-CsMirrorDatabase-ca7fc931-e778-40f4-bc17-9c7d51040855.xml".

Uninstall Mirrors
Uninstall mirrors required by Lync Server role(s). Note that the cmdlet will try its best to drop the databases on the mirror server, but
this is not guaranteed. After the cmdlet is finished, manually verify that the databases are dropped. If the databases are not dropped, drop
 the databases manually. Are you sure you want to proceed?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): y
VERBOSE: No changes were made to the Central Management Store.
VERBOSE: Creating new log file
"C:\Users\Administrator.DOMAIN\AppData\Local\Temp\2\Uninstall-CsMirrorDatabase-ca7fc931-e778-40f4-bc17-9c7d51040855.html".
WARNING: Uninstall-CsMirrorDatabase failed.
WARNING: Detailed results can be found at
"C:\Users\Administrator.DOMAIN\AppData\Local\Temp\2\Uninstall-CsMirrorDatabase-ca7fc931-e778-40f4-bc17-9c7d51040855.html".

On the Primary SQL Server:



As can be seen above, the cpsdyn, rgsconfig, and rgsdyn databases (which make up the Application database type) have now had their mirror configuration removed (ie. There is no “Principal, Synchronized” state written next to them now).

An important part of the command that we just ran was the “-DropExistingDatabasesOnMirror” switch, which tells Lync to delete these databases from the mirror server. Unfortunately, this function doesn't seem to always work, and databases can be left on the mirror server. So now we need to check the SQL instance on the Mirror server to see if these were deleted.

On the Mirror SQL Server:



From the screenshot above we can see that on the secondary server, the rgsconfig database has been automatically deleted. The cpsdyn and rgsdyn databases, however, are still there but stuck in “Restoring…” state. These databases will get re-created later when the Mirror is reconfigured between the two SQL servers, so it’s safe to manually delete these databases:



Step 5: Install the new schema updates on the Primary Database

Run the following command to install the Schema updates:

Install-CsDatabase -ConfiguredDatabases -SqlServerFqdn DOMAINSQL001.domain.com -Verbose

NOTE: The error below can be caused by not having enough free disk space on the SQL servers. This is most likely to happen in a lab environment where you’ve only provisioned the minimum disk space for each machine. I had this happen with 15.3GB of disk space free, however, when I expanded the disk to have 29GB free this error went away.

Install-CsDatabase : Command execution failed: Cannot find any suitable disks for database files. You must manually specify database paths.
At line:1 char:1
+ Install-CsDatabase -ConfiguredDatabases -SqlServerFqdn DOMAINSQL001.mylynclab.c ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Install-CsDatabase], DeploymentException
    + FullyQualifiedErrorId : ProcessingFailed,Microsoft.Rtc.Management.Deployment.InstallDatabaseCmdlet

The execution of this command will look like this:

PS C:\Users\Administrator.DOMAIN> Install-CsDatabase -ConfiguredDatabases -SqlServerFqdn DOMAINSQL001.domain.com -Verbose
VERBOSE: Creating new log file
"C:\Users\Administrator.DOMAIN\AppData\Local\Temp\2\Install-CsDatabase-817afad5-d1d5-42dc-a4cf-70589c7bdd09.xml".
VERBOSE: Install databases required by Lync Server role(s).
VERBOSE: Skipping Central Management Database "1-CentralMgmtStore-1". Central Management Databases are installed using the
-CentralManagementDatabase parameter.
****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.BlobStore'****
Trying to connect to Sql Server DOMAINSQL001.domain.com\Lync2013. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Checking state for database rtcxds.
****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.RtcSharedDatabase'****
Trying to connect to Sql Server DOMAINSQL001.domain.com\Lync2013. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Checking state for database rtcshared.
****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.AbsDatabase'****
Trying to connect to Sql Server DOMAINSQL001.domain.com\Lync2013. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Checking state for database rtcab.
****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.RgsConfigDatabase'****
Trying to connect to Sql Server DOMAINSQL001.domain.com\Lync2013. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Checking state for database rgsconfig.
****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.RgsDynDatabase'****
Trying to connect to Sql Server DOMAINSQL001.domain.com\Lync2013. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Checking state for database rgsdyn.
****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.CpsDynDatabase'****
Trying to connect to Sql Server DOMAINSQL001.domain.com\Lync2013. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Checking state for database cpsdyn.
****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.ArchivingDatabase'****
Trying to connect to Sql Server DOMAINSQL001.domain.com\Lync2013. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Checking state for database LcsLog.
****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.MonitoringDatabase'****
Trying to connect to Sql Server DOMAINSQL001.domain.com\Lync2013. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Checking state for database LcsCDR.
****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.QoEMetricsDatabase'****
Trying to connect to Sql Server DOMAINSQL001.domain.com\Lync2013. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Checking state for database QoEMetrics.
****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.MgcDatabase'****
Trying to connect to Sql Server DOMAINSQL001.domain.com\Lync2013. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Checking state for database mgc.
****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.MgcCompDatabase'****
Trying to connect to Sql Server DOMAINSQL001.domain.com\Lync2013. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Checking state for database mgccomp.
VERBOSE: Assigning "BackendStore:BlobStore:LogPath" to C:\CsData
VERBOSE: Assigning "BackendStore:RtcSharedDatabase:LogPath" to C:\CsData
VERBOSE: Assigning "ArchivingStore:ArchivingDatabase:LogPath" to C:\CsData
VERBOSE: Assigning "MonitoringStore:MonitoringDatabase:LogPath" to C:\CsData
VERBOSE: Assigning "MonitoringStore:QoEMetricsDatabase:LogPath" to C:\CsData
VERBOSE: Assigning "ArchivingStore:ArchivingDatabase:DbPath" to C:\CsData
VERBOSE: Assigning "MonitoringStore:MonitoringDatabase:DbPath" to C:\CsData
VERBOSE: Assigning "MonitoringStore:QoEMetricsDatabase:DbPath" to C:\CsData
VERBOSE: Assigning "ABSStore:AbsDatabase:LogPath" to C:\CsData
VERBOSE: Assigning "ApplicationStore:RgsConfigDatabase:LogPath" to C:\CsData
VERBOSE: Assigning "ApplicationStore:RgsDynDatabase:LogPath" to C:\CsData
VERBOSE: Assigning "ApplicationStore:CpsDynDatabase:LogPath" to C:\CsData
VERBOSE: Assigning "PersistentChatStore:MgcDatabase:LogPath" to C:\CsData
VERBOSE: Assigning "PersistentChatComplianceStore:MgcCompDatabase:LogPath" to C:\CsData
VERBOSE: Assigning "BackendStore:BlobStore:DbPath" to C:\CsData
VERBOSE: Assigning "BackendStore:RtcSharedDatabase:DbPath" to C:\CsData
VERBOSE: Assigning "ABSStore:AbsDatabase:DbPath" to C:\CsData
VERBOSE: Assigning "ApplicationStore:RgsConfigDatabase:DbPath" to C:\CsData
VERBOSE: Assigning "ApplicationStore:RgsDynDatabase:DbPath" to C:\CsData
VERBOSE: Assigning "ApplicationStore:CpsDynDatabase:DbPath" to C:\CsData
VERBOSE: Assigning "PersistentChatStore:MgcDatabase:DbPath" to C:\CsData
VERBOSE: Assigning "PersistentChatComplianceStore:MgcCompDatabase:DbPath" to C:\CsData
VERBOSE: Installing "BackendStore" on DOMAINSQL001.domain.com\Lync2013, collocated: False
****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.BlobStore'****
Trying to connect to Sql Server DOMAINSQL001.domain.com\Lync2013. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Checking state for database rtcxds.
Database created by script "BlobStore" already exists and is current.

****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.RtcSharedDatabase'****
Trying to connect to Sql Server DOMAINSQL001.domain.com\Lync2013. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Checking state for database rtcshared.
Database created by script "RtcSharedDatabase" already exists and is current.

VERBOSE: Successfully installed the database. For details, see the following log:
"C:\Users\Administrator.DOMAIN\AppData\Local\Temp\2\Create-BackendStore-DOMAINSQL001.domain.com_Lync2013-[2013_06_05][13_10_24].log"
VERBOSE: Installing "ABSStore" on DOMAINSQL001.domain.com\Lync2013, collocated: False
****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.AbsDatabase'****
Trying to connect to Sql Server DOMAINSQL001.domain.com\Lync2013. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Checking state for database rtcab.
Database created by script "AbsDatabase" already exists and is current.

VERBOSE: Successfully installed the database. For details, see the following log:
"C:\Users\Administrator.DOMAIN\AppData\Local\Temp\2\Create-ABSStore-DOMAINSQL001.domain.com_Lync2013-[2013_06_05][13_10_24].log"
VERBOSE: Installing "ApplicationStore" on DOMAINSQL001.domain.com\Lync2013, collocated: False
****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.RgsConfigDatabase'****
Trying to connect to Sql Server DOMAINSQL001.domain.com\Lync2013. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Checking state for database rgsconfig.
Database created by script "RgsConfigDatabase" already exists and is current.

****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.RgsDynDatabase'****
Trying to connect to Sql Server DOMAINSQL001.domain.com\Lync2013. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Checking state for database rgsdyn.
Database created by script "RgsDynDatabase" already exists and is current.

****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.CpsDynDatabase'****
Trying to connect to Sql Server DOMAINSQL001.domain.com\Lync2013. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Checking state for database cpsdyn.
Creating database cpsdyn from scratch. Data File Path = C:\CsData\ApplicationStore\Lync2013\DbPath, Log File Path= C:\CsData\ApplicationStore\Lync2013\LogPath.
Setting the database cpsdyn to single user mode.
Database cpsdyn set to mode Single.
Setting the database cpsdyn to restricted mode.
Database cpsdyn set to mode Restricted.
WARNING: Setting SQL Server Show Advanced Options to 1
WARNING: Setting SQL Server Recover Interval to 5 mins.
Executing CpsDyn.sql...
Setting owner for database cpsdyn to sa.
Creating login DOMAIN\RTCComponentUniversalServices.
Creating user DOMAIN\RTCComponentUniversalServices.
Creating Schema DOMAIN\RTCComponentUniversalServices.
Creating login DOMAIN\RTCUniversalReadOnlyAdmins.
Creating user DOMAIN\RTCUniversalReadOnlyAdmins.
Creating Schema DOMAIN\RTCUniversalReadOnlyAdmins.
Creating login DOMAIN\RTCUniversalServerAdmins.
Creating user DOMAIN\RTCUniversalServerAdmins.
Creating Schema DOMAIN\RTCUniversalServerAdmins.
Adding account DOMAIN\RTCComponentUniversalServices to role ReadWriteRole.
Adding account DOMAIN\RTCUniversalServerAdmins to role ReadWriteRole.
Adding account DOMAIN\RTCUniversalReadOnlyAdmins to role ReadOnlyRole.
Setting database version: Schema Version 1, Sproc Version 1, Update Version 2.
Setting the database cpsdyn to multi user mode.
Database cpsdyn is set to multi user mode.
VERBOSE: Successfully installed the database. For details, see the following log:
"C:\Users\Administrator.DOMAIN\AppData\Local\Temp\2\Create-ApplicationStore-DOMAINSQL001.domain.com_Lync2013-[2013_06_05][13_10_25].log
"
VERBOSE: Installing "ArchivingStore" on DOMAINSQL001.domain.com\Lync2013, collocated: False
****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.ArchivingDatabase'****
Trying to connect to Sql Server DOMAINSQL001.domain.com\Lync2013. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Checking state for database LcsLog.
Database created by script "ArchivingDatabase" already exists and is current.

VERBOSE: Successfully installed the database. For details, see the following log:
"C:\Users\Administrator.DOMAIN\AppData\Local\Temp\2\Create-ArchivingStore-DOMAINSQL001.domain.com_Lync2013-[2013_06_05][13_10_34].log"
VERBOSE: Installing "MonitoringStore" on DOMAINSQL001.domain.com\Lync2013, collocated: False
****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.MonitoringDatabase'****
Trying to connect to Sql Server DOMAINSQL001.domain.com\Lync2013. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Checking state for database LcsCDR.
Database created by script "MonitoringDatabase" already exists and is current.

****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.QoEMetricsDatabase'****
Trying to connect to Sql Server DOMAINSQL001.domain.com\Lync2013. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Checking state for database QoEMetrics.
Database created by script "QoEMetricsDatabase" already exists and is current.

VERBOSE: Successfully installed the database. For details, see the following log:
"C:\Users\Administrator.DOMAIN\AppData\Local\Temp\2\Create-MonitoringStore-DOMAINSQL001.domain.com_Lync2013-[2013_06_05][13_10_34].log"
VERBOSE: Installing "PersistentChatStore" on DOMAINSQL001.domain.com\Lync2013, collocated: False
****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.MgcDatabase'****
Trying to connect to Sql Server DOMAINSQL001.domain.com\Lync2013. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Checking state for database mgc.
Checking state for database mgc.
State of database mgc is DbState_NotAccessible.
Database 'mgc' exists but not accessible. It must be repaired manually or dropped and a new one created. if you want to preserve data, you must use this product's backup/e
. Examine the product documentation for instructions.
Install-CsDatabase : An error occurred while creating or updating the database for feature PersistentChatStore. For details, see the log file
'C:\Users\Administrator.DOMAIN\AppData\Local\Temp\2\Create-PersistentChatStore-DOMAINSQL001.domain.com_Lync2013-[2013_06_05][13_10_34].log'
At line:1 char:1
+ Install-CsDatabase -ConfiguredDatabases -SqlServerFqdn DOMAINSQL001.mylynclab.c ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:SourceCollection) [Install-CsDatabase], DbSetupDatabaseInUnusableStateException
    + FullyQualifiedErrorId : InstallDatabaseInternalFailure,Microsoft.Rtc.Management.Deployment.InstallDatabaseCmdlet
VERBOSE: Successfully installed the database. For details, see the following log:
"C:\Users\Administrator.DOMAIN\AppData\Local\Temp\2\Create-PersistentChatStore-DOMAINSQL001.domain.com_Lync2013-[2013_06_05][13_10_34].
log"
VERBOSE: Installing "PersistentChatComplianceStore" on DOMAINSQL001.domain.com\Lync2013, collocated: False
****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.MgcCompDatabase'****
Trying to connect to Sql Server DOMAINSQL001.domain.com\Lync2013. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Checking state for database mgccomp.
Checking state for database mgccomp.
State of database mgccomp is DbState_NotAccessible.
Database 'mgccomp' exists but not accessible. It must be repaired manually or dropped and a new one created. if you want to preserve data, you must use this product's back
tion. Examine the product documentation for instructions.
Install-CsDatabase : An error occurred while creating or updating the database for feature PersistentChatComplianceStore. For details, see the log file
'C:\Users\Administrator.DOMAIN\AppData\Local\Temp\2\Create-PersistentChatComplianceStore-DOMAINSQL001.domain.com_Lync2013-[2013_06_05][13_10_34].log'
At line:1 char:1
+ Install-CsDatabase -ConfiguredDatabases -SqlServerFqdn DOMAINSQL001.mylynclab.c ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:SourceCollection) [Install-CsDatabase], DbSetupDatabaseInUnusableStateException
    + FullyQualifiedErrorId : InstallDatabaseInternalFailure,Microsoft.Rtc.Management.Deployment.InstallDatabaseCmdlet
VERBOSE: Successfully installed the database. For details, see the following log:
"C:\Users\Administrator.DOMAIN\AppData\Local\Temp\2\Create-PersistentChatComplianceStore-DOMAINSQL001.domain.com_Lync2013-[2013_06_05][
13_10_34].log"
VERBOSE: No changes were made to the Central Management Store.
VERBOSE: Creating new log file
"C:\Users\Administrator.DOMAIN\AppData\Local\Temp\2\Install-CsDatabase-817afad5-d1d5-42dc-a4cf-70589c7bdd09.html".
WARNING: Install-CsDatabase encountered errors. Consult the log file for a detailed analysis, and ensure all errors (4) and warnings (2) are
 addressed before continuing.
WARNING: Detailed results can be found at
"C:\Users\Administrator.DOMAIN\AppData\Local\Temp\2\Install-CsDatabase-817afad5-d1d5-42dc-a4cf-70589c7bdd09.html".

As you can see in the above output, I had two failures in the upgrade process. These failures were on the ‘mgc’ and the ‘mgccomp’ database, which both happen to be Persistent Chat databases. The reason for this was that I didn’t check if they were running on the Primary SQL instance back in Step 3 (I did this for the example to show what happens when you don’t do this. Really you should have done this check back in Step 3). So now when I check the status of the Persistent Chat databases with the Database Mirror Manager I notice that they are both on the Secondary SQL instance:


To change these back over I just clicked on the Primary check boxes for both of these databases and then click the Invoke button. Within the Powershell window you will be asked if you want to change the PersistentChat and PersistentChatCompliance databases over to Primary, which you answer “y” to:

Invoking change of PersistentChat database to Primary

Confirm
Are you sure you want to perform this action?
Performing operation "Invoke-CsDatabaseFailover" on Target "PersistentChatService".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): y

Invoking change of PersistentChatCompliance database to Primary

Confirm
Are you sure you want to perform this action?
Performing operation "Invoke-CsDatabaseFailover" on Target "PersistentChatService".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): y

---------------------------------------------------

Now the Persistent Chat databases are running back on the Primary SQL. So run the Install-CsDatabase command again to ensure that the Persistent Chat databases are also updated:

PS C:\Users\Administrator.DOMAIN> Install-CsDatabase -ConfiguredDatabases -SqlServerFqdn DOMAINSQL001.domain.com -Verbose
VERBOSE: Creating new log file
"C:\Users\Administrator.DOMAIN\AppData\Local\Temp\2\Install-CsDatabase-01cfc038-b340-4894-91a1-55d3864d7c2c.xml".
VERBOSE: Install databases required by Lync Server role(s).
VERBOSE: Skipping Central Management Database "1-CentralMgmtStore-1". Central Management Databases are installed using the
-CentralManagementDatabase parameter.
****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.BlobStore'****
Trying to connect to Sql Server DOMAINSQL001.domain.com\Lync2013. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Checking state for database rtcxds.
****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.RtcSharedDatabase'****
Trying to connect to Sql Server DOMAINSQL001.domain.com\Lync2013. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Checking state for database rtcshared.
****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.AbsDatabase'****
Trying to connect to Sql Server DOMAINSQL001.domain.com\Lync2013. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Checking state for database rtcab.
****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.RgsConfigDatabase'****
Trying to connect to Sql Server DOMAINSQL001.domain.com\Lync2013. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Checking state for database rgsconfig.
****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.RgsDynDatabase'****
Trying to connect to Sql Server DOMAINSQL001.domain.com\Lync2013. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Checking state for database rgsdyn.
****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.CpsDynDatabase'****
Trying to connect to Sql Server DOMAINSQL001.domain.com\Lync2013. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Checking state for database cpsdyn.
****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.ArchivingDatabase'****
Trying to connect to Sql Server DOMAINSQL001.domain.com\Lync2013. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Checking state for database LcsLog.
****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.MonitoringDatabase'****
Trying to connect to Sql Server DOMAINSQL001.domain.com\Lync2013. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Checking state for database LcsCDR.
****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.QoEMetricsDatabase'****
Trying to connect to Sql Server DOMAINSQL001.domain.com\Lync2013. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Checking state for database QoEMetrics.
****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.MgcDatabase'****
Trying to connect to Sql Server DOMAINSQL001.domain.com\Lync2013. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Checking state for database mgc.
****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.MgcCompDatabase'****
Trying to connect to Sql Server DOMAINSQL001.domain.com\Lync2013. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Checking state for database mgccomp.
VERBOSE: All databases at the specified installation location are already up to date.
VERBOSE: No changes were made to the Central Management Store.
VERBOSE: Creating new log file
"C:\Users\Administrator.DOMAIN\AppData\Local\Temp\2\Install-CsDatabase-01cfc038-b340-4894-91a1-55d3864d7c2c.html".
VERBOSE: "Install-CsDatabase" processing has completed successfully.
VERBOSE: Detailed results can be found at
"C:\Users\Administrator.DOMAIN\AppData\Local\Temp\2\Install-CsDatabase-01cfc038-b340-4894-91a1-55d3864d7c2c.html".
PS C:\Users\Administrator.DOMAIN>

Now our Application database schema has been updated and is ready to run all the new features of CU1.

Step 6: Re-establish the Database Mirror

Run the following command:

Install-CsMirrorDatabase -DatabaseType Application -SqlServerFQDN DOMAINSQL001.domain.com -SqlInstanceName Lync2013 -FileShare \\DOMAINSQL001.domain.com\FileShare -Verbose

Command output example:

PS > Install-CsMirrorDatabase -DatabaseType Application -SqlServerFQDN DOMAINSQL001.domain.com -SqlInstanceName Lync2013 -FileShare "\\DOMAINSQL001.domain.com\Fil
eShare" -Verbose
VERBOSE: Creating new log file
"C:\Users\Administrator.DOMAIN\AppData\Local\Temp\2\Install-CsMirrorDatabase-be00671d-7932-4f68-b657-66a9b3c560e6.xml".

Install Mirror Database
This cmdlet sets up mirroring for databases on primary SQL Server instance on the mirror SQL Server instance. If a witness is specified, it also sets up a witness for databases on the primary SQL Server instance.

 The following databases will be mirrored and configured with a witness if a witness is specified:
    Database Name:rgsconfig
        Data File:C:\CsData\ApplicationStore\Lync2013\DbPath\rgsconfig.mdf
         Log File:C:\CsData\ApplicationStore\Lync2013\LogPath\rgsconfig.ldf
      Primary SQL: DOMAINSQL001.domain.com\Lync2013
          Account: DOMAIN\DOMAINSQL001$
       Mirror SQL: DOMAINSQL002.domain.com\Lync2013
          Account: DOMAIN\DOMAINSQL002$
     Witness SQL : DOMAINSQL003.domain.com\Lync2013
          Account: DOMAIN\DOMAINSQL003$


    Database Name:rgsdyn
        Data File:C:\CsData\ApplicationStore\Lync2013\DbPath\rgsdyn.mdf
         Log File:C:\CsData\ApplicationStore\Lync2013\LogPath\rgsdyn.ldf
      Primary SQL: DOMAINSQL001.domain.com\Lync2013
          Account: DOMAIN\DOMAINSQL001$
       Mirror SQL: DOMAINSQL002.domain.com\Lync2013
          Account: DOMAIN\DOMAINSQL002$
     Witness SQL : DOMAINSQL003.domain.com\Lync2013
          Account: DOMAIN\DOMAINSQL003$


    Database Name:cpsdyn
        Data File:C:\CsData\ApplicationStore\Lync2013\DbPath\cpsdyn.mdf
         Log File:C:\CsData\ApplicationStore\Lync2013\LogPath\cpsdyn.ldf
      Primary SQL: DOMAINSQL001.domain.com\Lync2013
          Account: DOMAIN\DOMAINSQL001$
       Mirror SQL: DOMAINSQL002.domain.com\Lync2013
          Account: DOMAIN\DOMAINSQL002$
     Witness SQL : DOMAINSQL003.domain.com\Lync2013
          Account: DOMAIN\DOMAINSQL003$



 Verify that the following things are taken care of before proceeding:
    Port 5022 is accessible through the firewall if Windows Firewall is enabled in the primary SQL Server
DOMAINSQL001.domain.com\Lync2013.
    Port 5022 is accessible through the firewall if Windows Firewall is enabled in the mirror SQL Server
DOMAINSQL002.domain.com\Lync2013.
    Port 7022 is accessible through the firewall if Windows Firewall is enabled in the witness SQL Server
DOMAINSQL003.domain.com\Lync2013.
    Accounts running the SQL Servers on all primary and mirror SQL servers have read/write permissions to the file share
\\DOMAINSQL001.domain.com\FileShare


    The cmdlet will use WMI provider to find the account information for SQL Server services running on all primary, mirror and witness
servers. Verify that WMI provider is running on all these servers.


    The cmdlet will try to create folders for data and log files for all the mirror servers. Verify that the account running this cmdlet has
 permission to create these folders.
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): y
VERBOSE: Mirroring was configured successfully for database "rgsconfig".
VERBOSE: Witness was configured successfully for database "rgsconfig".
VERBOSE: Mirroring was configured successfully for database "rgsdyn".
VERBOSE: Witness was configured successfully for database "rgsdyn".
VERBOSE: Mirroring was configured successfully for database "cpsdyn".
VERBOSE: Witness was configured successfully for database "cpsdyn".
VERBOSE: Successfully created SQL Server Agent jobs on DOMAINSQL002.domain.com\Lync2013.
VERBOSE: No changes were made to the Central Management Store.
VERBOSE: Creating new log file
"C:\Users\Administrator.DOMAIN\AppData\Local\Temp\2\Install-CsMirrorDatabase-be00671d-7932-4f68-b657-66a9b3c560e6.html".
VERBOSE: "Install-CsMirrorDatabase" processing has completed successfully.
VERBOSE: Detailed results can be found at
"C:\Users\Administrator.DOMAIN\AppData\Local\Temp\2\Install-CsMirrorDatabase-be00671d-7932-4f68-b657-66a9b3c560e6.html".
PS C:\Users\Administrator.DOMAIN>

Note: If you get an RPC error at this point like the example I've provided below, it’s likely caused by ports being blocked on the Windows Firewall of the SQL servers.
PS > Install-CsMirrorDatabase -DatabaseType Application -SqlServerFQDN DOMAINSQL001.domain.com -SqlInstanceName Lync2013 -FileShare "\\DOMAINSQL001.domain.com\FileShare" -Verbose
VERBOSE: Creating new log file
"C:\Users\Administrator.DOMAIN\AppData\Local\Temp\2\Install-CsMirrorDatabase-20abaefd-828b-4920-b221-6d15774ea486.xml".
VERBOSE: Creating new log file
"C:\Users\Administrator.DOMAIN\AppData\Local\Temp\2\Install-CsMirrorDatabase-20abaefd-828b-4920-b221-6d15774ea486.html".
WARNING: Install-CsMirrorDatabase failed.
WARNING: Detailed results can be found at
"C:\Users\Administrator.DOMAIN\AppData\Local\Temp\2\Install-CsMirrorDatabase-20abaefd-828b-4920-b221-6d15774ea486.html".
Install-CsMirrorDatabase : Command execution failed: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
At line:1 char:1
+ Install-CsMirrorDatabase -DatabaseType Application -SqlServerFQDN DOMAINSQL001. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Install-CsMirrorDatabase], COMException
    + FullyQualifiedErrorId : ProcessingFailed,Microsoft.Rtc.Management.Deployment.InstallMirrorDatabaseCmdlet

From the testing that I have done, I’ve found that the Ports that need to be open to avoid these errors are TCP 135, TCP 445 and TCP 49154-49155. This is in addition to the SQL Mirroring signalling ports that also need to be opened: TCP 5022 on the Primary and Secondary servers, and  TCP 7022 on the Witness server (also the regular SQL ports UDP 1434, TCP 1433, and the Dynamic TCP port used when Named SQL database is used).

Step 7: Confirm that the databases are all back up and running

Check the state of the database mirror:

Get-CsDatabaseMirrorState -PoolFqdn melbfepool.domain.com -Verbose

Note: You could also do this check with the Mirror Manager Tool. However, just in case there is some edge case where the mirror has failed to re-establish (with an error I haven’t seen before), it’s probably best to use the command in this circumstance.

PS C:\Users\Administrator.DOMAIN> Get-CsDatabaseMirrorState -PoolFqdn melbfepool.domain.com -Verbose
VERBOSE: Creating new log file
"C:\Users\Administrator.DOMAIN\AppData\Local\Temp\2\Get-CsDatabaseMirrorState-22e57066-60a0-4d5a-a699-3e7e0fcf3894.
xml".
VERBOSE: Primary SQL Server Instance: DOMAINSQL001.domain.com\Lync2013
VERBOSE: Mirror SQL Server Instance: DOMAINSQL002.domain.com\Lync2013


DatabaseName             : rtcab
StateOnPrimary           : Principal
StateOnMirror            : Mirror
MirroringStatusOnPrimary : synchronized
MirroringStatusOnMirror  : synchronized

DatabaseName             : rtcxds
StateOnPrimary           : Principal
StateOnMirror            : Mirror
MirroringStatusOnPrimary : synchronized
MirroringStatusOnMirror  : synchronized

DatabaseName             : rtcshared
StateOnPrimary           : Principal
StateOnMirror            : Mirror
MirroringStatusOnPrimary : synchronized
MirroringStatusOnMirror  : synchronized

VERBOSE: Primary SQL Server Instance: DOMAINSQL001.domain.com\Lync2013
VERBOSE: Mirror SQL Server Instance: DOMAINSQL002.domain.com\Lync2013
DatabaseName             : lcscdr
StateOnPrimary           : Principal
StateOnMirror            : Mirror
MirroringStatusOnPrimary : synchronized
MirroringStatusOnMirror  : synchronized

DatabaseName             : qoemetrics
StateOnPrimary           : Principal
StateOnMirror            : Mirror
MirroringStatusOnPrimary : synchronized
MirroringStatusOnMirror  : synchronized

VERBOSE: Primary SQL Server Instance: DOMAINSQL001.domain.com\Lync2013
VERBOSE: Mirror SQL Server Instance: DOMAINSQL002.domain.com\Lync2013
DatabaseName             : lcslog
StateOnPrimary           : Principal
StateOnMirror            : Mirror
MirroringStatusOnPrimary : synchronized
MirroringStatusOnMirror  : synchronized

VERBOSE: Primary SQL Server Instance: DOMAINSQL001.domain.com\Lync2013
VERBOSE: Mirror SQL Server Instance: DOMAINSQL002.domain.com\Lync2013
DatabaseName             : rgsconfig
StateOnPrimary           : Principal
StateOnMirror            : Mirror
MirroringStatusOnPrimary : synchronized
MirroringStatusOnMirror  : synchronized

DatabaseName             : rgsdyn
StateOnPrimary           : Principal
StateOnMirror            : Mirror
MirroringStatusOnPrimary : synchronized
MirroringStatusOnMirror  : synchronized

DatabaseName             : cpsdyn
StateOnPrimary           : Principal
StateOnMirror            : Mirror
MirroringStatusOnPrimary : synchronized
MirroringStatusOnMirror  : synchronized

VERBOSE: Primary SQL Server Instance: DOMAINSQL001.domain.com\Lync2013
VERBOSE: Mirror SQL Server Instance: DOMAINSQL002.domain.com\Lync2013
DatabaseName             : xds
StateOnPrimary           : Principal
StateOnMirror            : Mirror
MirroringStatusOnPrimary : synchronized
MirroringStatusOnMirror  : synchronized

DatabaseName             : lis
StateOnPrimary           : Principal
StateOnMirror            : Mirror
MirroringStatusOnPrimary : synchronized
MirroringStatusOnMirror  : synchronized

VERBOSE: No changes were made to the Central Management Store.
VERBOSE: Creating new log file
"C:\Users\Administrator.DOMAIN\AppData\Local\Temp\2\Get-CsDatabaseMirrorState-22e57066-60a0-4d5a-a699-3e7e0fcf3894.
html".
VERBOSE: "Get-CsDatabaseMirrorState" processing has completed successfully.
VERBOSE: Detailed results can be found at
"C:\Users\Administrator.DOMAIN\AppData\Local\Temp\2\Get-CsDatabaseMirrorState-22e57066-60a0-4d5a-a699-3e7e0fcf3894.
html".

PS >

From the above output you will see that rgsconfig, rgsdyn, and cpsdyn are back in Principal state on the Primary server.

Step 8 (Optional): If you have your Archiving and Monitoring databases on a different SQL backend than the main Lync databases are stored you need to run the install on it now:

Install-CsDatabase -ConfiguredDatabases -SqlServerFqdn DOMAINARC001.domain.com -Verbose

Step 9: After we have finished updating all the Lync databases we need to now update the CMS database with the following command:

Install-CsDatabase -CentralManagementDatabase –SqlServerFqdn DOMAINSQL001.domain.com -SqlInstanceName Lync2013 –Verbose

The output of the command will look something like this:

PS C:\Users\Administrator.DOMAIN> Install-CsDatabase -CentralManagementDatabase -SqlServerFqdn DOMAINSQL001.domain.com -SqlInstanceName Lync2013 -Verbose
VERBOSE: Creating new log file
"C:\Users\Administrator.DOMAIN\AppData\Local\Temp\2\Install-CsDatabase-6b47e723-1091-4669-bb19-c1d673ad5612.xml".
VERBOSE: Install databases required by Lync Server role(s).
****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.XdsDatabase'****
Trying to connect to Sql Server DOMAINSQL001.domain.com\Lync2013. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Checking state for database xds.
VERBOSE: Assigning "CentralMgmtStore:XdsDatabase:LogPath" to C:\CsData
VERBOSE: Assigning "CentralMgmtStore:LisDatabase:LogPath" to C:\CsData
VERBOSE: Assigning "CentralMgmtStore:XdsDatabase:DbPath" to C:\CsData
VERBOSE: Assigning "CentralMgmtStore:LisDatabase:DbPath" to C:\CsData
VERBOSE: Installing "CentralMgmtStore" on DOMAINSQL001.domain.com\Lync2013, collocated: False
****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.XdsDatabase'****
Trying to connect to Sql Server DOMAINSQL001.domain.com\Lync2013. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Checking state for database xds.
Checking state for database xds.
Checking state for database xds.
State of database xds is DbState_RequiresMinorUpgrade.
Database xds set to mode Restricted.
Dropping all procedures, functions and views from database xds.
Executing Xds.sql...
Adding master role...
Setting database state to active...
Setting owner for database xds to sa.
Creating login DOMAIN\RTCUniversalConfigReplicator.
Creating user DOMAIN\RTCUniversalConfigReplicator.
Creating Schema DOMAIN\RTCUniversalConfigReplicator.
Creating login DOMAIN\RTCUniversalReadOnlyAdmins.
Creating user DOMAIN\RTCUniversalReadOnlyAdmins.
Creating Schema DOMAIN\RTCUniversalReadOnlyAdmins.
Creating login DOMAIN\RTCUniversalServerAdmins.
Creating user DOMAIN\RTCUniversalServerAdmins.
Creating Schema DOMAIN\RTCUniversalServerAdmins.
Adding account DOMAIN\RTCUniversalReadOnlyAdmins to role ConsumerRole.
Adding account DOMAIN\RTCUniversalConfigReplicator to role ReplicatorRole.
Adding account DOMAIN\RTCUniversalServerAdmins to role PublisherRole.
Setting database version: Schema Version 10, Sproc Version 13, Update Version 2.
Setting the database xds to multi user mode.
Database xds is set to multi user mode.
****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.LisDatabase'****
Trying to connect to Sql Server DOMAINSQL001.domain.com\Lync2013. using windows authentication...
Sql version: Major: 11, Minor: 0, Build 2100.
Sql version is acceptable.
Checking state for database lis.
Database created by script "LisDatabase" already exists and is current.

VERBOSE: Successfully installed the database. For details, see the following log:
"C:\Users\Administrator.DOMAIN\AppData\Local\Temp\2\Create-CentralMgmtStore-DOMAINSQL001.domain.com_Lync2013-[2013_06_05][17_01_59].log
"
VERBOSE: Creating new log file
"C:\Users\Administrator.DOMAIN\AppData\Local\Temp\2\Install-CsDatabase-6b47e723-1091-4669-bb19-c1d673ad5612.html".
VERBOSE: "Install-CsDatabase" processing has completed successfully.
VERBOSE: Detailed results can be found at
"C:\Users\Administrator.DOMAIN\AppData\Local\Temp\2\Install-CsDatabase-6b47e723-1091-4669-bb19-c1d673ad5612.html".
PS C:\Users\Administrator.DOMAIN>

Step 10: To enable the Mobility service, run the following cmdlet:

Enable-CsTopology

Step 11: To enable the Unified Communications Web API (UCWA), you must run the Bootstrapper.exe tool again on all Lync Server 2013 servers on which the Web Components were installed and updated. The command to run the tool is as follows:

"%ProgramFiles%\Microsoft Lync Server 2013\Deployment\Bootstrapper.exe"

The command executes like this:

C:\Program Files\Common Files\Microsoft Lync Server 2013>"%ProgramFiles%\Microsoft Lync Server 2013\Deployment\Bootstrapper.exe"
Logging status to: C:\Users\Administrator.DOMAIN\AppData\Local\Temp\2\Bootstrap-CsMachine-[2013_06_06][10_17_38].html
Checking prerequisites for bootstrapper...
Checking prerequisite WMIEnabled...prerequisite satisfied.
Checking prerequisite NoBootstrapperOnBranchOfficeAppliance...prerequisite satisfied.
Checking prerequisite SupportedOS...prerequisite satisfied.
Checking prerequisite NoOtherVersionInstalled...prerequisite satisfied.
Host name: DOMAINfe001.domain.com
Disabling unused roles...
Executing PowerShell command: Disable-CSComputer -Confirm:$false -Verbose -Report "C:\Users\Administrator.DOMAIN\AppData\Local\Temp\2\Disable-CSComputer-[2013_06_06][10_17_48].html"
Checking prerequisites for roles...
Checking prerequisite SupportedOS...prerequisite satisfied.
Checking prerequisite SupportedOSNoDC...prerequisite satisfied.
Checking prerequisite SupportedSqlRtcLocal...prerequisite satisfied.
Checking prerequisite WMIEnabled...prerequisite satisfied.
Checking prerequisite NoOtherVersionInstalled...prerequisite satisfied.
Checking prerequisite PowerShell...prerequisite satisfied.
Checking prerequisite WindowsIdentityFoundation...prerequisite satisfied.
Checking prerequisite SupportedServerOS...prerequisite satisfied.
Checking prerequisite NoUnsupportedWinFab...prerequisite satisfied.
Checking prerequisite SupportedSqlLyncLocal...prerequisite satisfied.
Checking prerequisite IIS...prerequisite satisfied.
Checking prerequisite IIS7Features...prerequisite satisfied.
Checking prerequisite ASPNet...prerequisite satisfied.
Checking prerequisite KB2646886Installed...prerequisite satisfied.
Checking prerequisite BranchCacheBlock...prerequisite satisfied.
Checking prerequisite WCF...prerequisite satisfied.
Checking prerequisite WindowsMediaFoundation...prerequisite satisfied.
Checking prerequisite SqlInstanceRtcLocal...prerequisite satisfied.
Checking prerequisite VCredist...prerequisite satisfied.
Checking prerequisite SqlNativeClient...prerequisite satisfied.
Checking prerequisite SqlClrTypes...prerequisite satisfied.
Checking prerequisite SqlSharedManagementObjects...prerequisite satisfied.
Checking prerequisite UcmaRedist...prerequisite satisfied.
Checking prerequisite WinFab...prerequisite satisfied.
Checking prerequisite MicrosoftIdentityExtensions...prerequisite satisfied.
Checking prerequisite SqlInstanceLyncLocal...prerequisite satisfied.
Checking prerequisite RewriteModule...prerequisite satisfied.
Checking prerequisite SpeechPlatformRuntime...prerequisite satisfied.
Checking prerequisite MSSpeech_TTS_ca-ES_Herena...prerequisite satisfied.
Checking prerequisite MSSpeech_TTS_da-DK_Helle...prerequisite satisfied.
Checking prerequisite MSSpeech_TTS_de-DE_Hedda...prerequisite satisfied.
Checking prerequisite MSSpeech_TTS_en-AU_Hayley...prerequisite satisfied.
Checking prerequisite MSSpeech_TTS_en-CA_Heather...prerequisite satisfied.
Checking prerequisite MSSpeech_TTS_en-GB_Hazel...prerequisite satisfied.
Checking prerequisite MSSpeech_TTS_en-IN_Heera...prerequisite satisfied.
Checking prerequisite MSSpeech_TTS_en-US_Helen...prerequisite satisfied.
Checking prerequisite MSSpeech_TTS_es-ES_Helena...prerequisite satisfied.
Checking prerequisite MSSpeech_TTS_es-MX_Hilda...prerequisite satisfied.
Checking prerequisite MSSpeech_TTS_fi-FI_Heidi...prerequisite satisfied.
Checking prerequisite MSSpeech_TTS_fr-CA_Harmonie...prerequisite satisfied.
Checking prerequisite MSSpeech_TTS_fr-FR_Hortense...prerequisite satisfied.
Checking prerequisite MSSpeech_TTS_it-IT_Lucia...prerequisite satisfied.
Checking prerequisite MSSpeech_TTS_ja-JP_Haruka...prerequisite satisfied.
Checking prerequisite MSSpeech_TTS_ko-KR_Heami...prerequisite satisfied.
Checking prerequisite MSSpeech_TTS_nb-NO_Hulda...prerequisite satisfied.
Checking prerequisite MSSpeech_TTS_nl-NL_Hanna...prerequisite satisfied.
Checking prerequisite MSSpeech_TTS_pl-PL_Paulina...prerequisite satisfied.
Checking prerequisite MSSpeech_TTS_pt-BR_Heloisa...prerequisite satisfied.
Checking prerequisite MSSpeech_TTS_pt-PT_Helia...prerequisite satisfied.
Checking prerequisite MSSpeech_TTS_ru-RU_Elena...prerequisite satisfied.
Checking prerequisite MSSpeech_TTS_sv-SE_Hedvig...prerequisite satisfied.
Checking prerequisite MSSpeech_TTS_zh-CN_HuiHui...prerequisite satisfied.
Checking prerequisite MSSpeech_TTS_zh-HK_HunYee...prerequisite satisfied.
Checking prerequisite MSSpeech_TTS_zh-TW_HanHan...prerequisite satisfied.
Checking prerequisite MSSpeech_SR_ca-ES_TELE...prerequisite satisfied.
Checking prerequisite MSSpeech_SR_da-DK_TELE...prerequisite satisfied.
Checking prerequisite MSSpeech_SR_de-DE_TELE...prerequisite satisfied.
Checking prerequisite MSSpeech_SR_en-AU_TELE...prerequisite satisfied.
Checking prerequisite MSSpeech_SR_en-CA_TELE...prerequisite satisfied.
Checking prerequisite MSSpeech_SR_en-GB_TELE...prerequisite satisfied.
Checking prerequisite MSSpeech_SR_en-IN_TELE...prerequisite satisfied.
Checking prerequisite MSSpeech_SR_en-US_TELE...prerequisite satisfied.
Checking prerequisite MSSpeech_SR_es-ES_TELE...prerequisite satisfied.
Checking prerequisite MSSpeech_SR_es-MX_TELE...prerequisite satisfied.
Checking prerequisite MSSpeech_SR_fi-FI_TELE...prerequisite satisfied.
Checking prerequisite MSSpeech_SR_fr-CA_TELE...prerequisite satisfied.
Checking prerequisite MSSpeech_SR_fr-FR_TELE...prerequisite satisfied.
Checking prerequisite MSSpeech_SR_it-IT_TELE...prerequisite satisfied.
Checking prerequisite MSSpeech_SR_ja-JP_TELE...prerequisite satisfied.
Checking prerequisite MSSpeech_SR_ko-KR_TELE...prerequisite satisfied.
Checking prerequisite MSSpeech_SR_nb-NO_TELE...prerequisite satisfied.
Checking prerequisite MSSpeech_SR_nl-NL_TELE...prerequisite satisfied.
Checking prerequisite MSSpeech_SR_pl-PL_TELE...prerequisite satisfied.
Checking prerequisite MSSpeech_SR_pt-BR_TELE...prerequisite satisfied.
Checking prerequisite MSSpeech_SR_pt-PT_TELE...prerequisite satisfied.
Checking prerequisite MSSpeech_SR_ru-RU_TELE...prerequisite satisfied.
Checking prerequisite MSSpeech_SR_sv-SE_TELE...prerequisite satisfied.
Checking prerequisite MSSpeech_SR_zh-CN_TELE...prerequisite satisfied.
Checking prerequisite MSSpeech_SR_zh-HK_TELE...prerequisite satisfied.
Checking prerequisite MSSpeech_SR_zh-TW_TELE...prerequisite satisfied.
Checking prerequisite UcmaWorkflowRuntime...prerequisite satisfied.
Installing any collocated databases...
Executing PowerShell command: Install-CSDatabase -Confirm:$false -Verbose -LocalDatabases -Report "C:\Users\Administrator.DOMAIN\AppData\Local\Temp\2\Install-CSDatabase-[2013_06_06][10_17_54].html"
Enabling new roles...
This step will configure services, apply permissions, create firewall rules, etc.
Executing PowerShell command: Enable-CSComputer -Confirm:$false -Verbose -Report "C:\Users\Administrator.DOMAIN\AppData\Local\Temp\2\Enable-CSComputer-[2013_06_06][10_18_28].html"
Complete.
Log file was: %TEMP%\Bootstrap-CsMachine-[2013_06_06][10_17_38].html


And we’re done!

The Wrap Up


It’s safe to say that updating a Lync server with a Mirrored Database is a bit more involved than doing a single database server. It’s one of those processes that if taken lightly might cause you some grief in the real world. Hopefully this post will help to make your life a little easier.


Read more →

Popular Posts