Restoring a Lync 2010 Infrastructure

How do you restore a broken Microsoft Lync 2010 System?

====
I had a rather distressed friend/old client on the phone over the last Bank Holiday - he’d done something that was causing him pain. They had had a Microsoft Lync 2010 system put in for a proof of concept - one that eventually went live (on to a new platform) over a year ago.

Now, while tidying up their VM Estate, and SQL, he queried whether the old PoC was needed - heard it wasn’t - and then binned it. Guess what - it was. It would appear that a department had been kept live on the old PoC to maintain separation or for some other such business reason.

This resulted in a bit of panic to try and get something working on a system that’s not really backed up or preserved - it’s a test system after all. Forgetting all the what/why/how, this led us to having to restore the whole infrastructure. Not massive - a single Lync 2010 Enterprise Edition Front End, and related SQL. Edge was already in but fortunately that was physical and he hadn’t gotten around to destroying that.

Anyway, restoring a Lync system isn’t that hard - so I as well as restoring the broken one over the weekend, I thought I’d write up how to do it too.

So here it is - how do we restore a Microsoft Lync 2010 system?

Test/Lab Scenario
In my lab for this, I have:

  • An Active Directory Forest called Small.local
  • A DC called DC1.small.local
  • An SQL Instance on DC1 dc1.small.local\Lync
  • A Lync 2010 Enterprise Edition Front End - FE1.small.local

To break it, I deleted ALL of the SQL databases, and I turned off and destroyed the Front-End. Fairly thorough I thought.

What Backups do I need?
Of course there are ways of restoring using SQL restoration, file server recovery etc. but for this instance I’m going to look at restoring using just two backup pieces:

  • A dump of user contacts
  • A backup of the topology made using the Lync PowerShell Environment

Just having the above is enough to restore - fortunately, we had both although admittedly from a couple of months ago.

How to get these backup items?
Firstly, exporting the user data to an XML file is pretty easy - you can do it with a tool installed on a Lync 2010 Front End Server by default - dbimpexp. You’ll typically find it in this path:

  • C:\Program Files\Common Files\Microsoft Lync Server 2010\support

To export the information from a
Standard Edition server, the command would like this:

  • dbimpexp.exe /hrxmlfile:filename

Note that if you just want to export the information for a single user, you can, by adding /user to the command, like this:

  • dbimpexp.exe /user:sipaddress /hrxmlfile:filename

For our example though, we want all of the stuff - I exported it all to ContactData.XML, and copied it to the domain controller DC1.

Exporting the Lync Topology using the Lync Management Shell is an absolute doddle - in fact, if you’ve configured a Lync Access Edge server already you’ll know how to do it - you use this command from the Lync Management Shell:

  • export-csConfiguration -FileName filename

In my lab, I exported the configuration to ‘TopologyBackup.ZIP’ and also placed it on my domain controller, DC1.

Restoration Environment
To understand how we’re going to restore, let’s look at the restoration environment I’m doing to install in to:

  • An Active Directory Forest called Small.local: Same
  • A DC called DC1.small.local: Same
  • An SQL Instance on DC1 dc1.small.local\Lync: Same - but all of the Lync SQL databases have been completely deleted
  • A newly built server called FE1.small.local

For the newly built Lync Front-End, I also installed all of the pre-reqs for a Lync 2010 Enterprise Edition front end such as DOT NET, and all the other elements such as IIS, Media components, and Message Queuing if needed.

So at this point, we have a clean environment with no Lync deployment in it - let’s look at the process for restoring.

Install Topology Builder & The Lync Management Shell
From the Lync 2010 DVD, install the Topology Builder from the main menu screen. This will also install the Lync Management Shell.

Recreate the Central Management Store Databases
Next, we are going to re-create the CMS Databases on our SQL Server. The command to use in the Lync Management Shell is as follows:

Install-CsDatabase -CentralManagementDatabase -SqlServerFqdn
dc1.small.local -SqlInstanceName Lync -Verbose

Our SQL server is on DC1.small.local and the instance is called ‘Lync’.

Set Active Directory Control Point for CMS
Next, we are going to set the AD reference for the CMS. To do that, you use the following command in the Lync Management Shell.

Set-CsConfigurationStoreLocation -SqlServerFqdn
dc1.small.local -SqlInstanceName Lync -Verbose

Our SQL server is on DC1.small.local and the instance is called ‘Lync’.

Restoring our Topology
Remember how we used ‘export-csConfiguration’ to create our topology ZIP file earlier? While, now we’re going to use its counterpart ‘import-csConfiguration’ to import it to our newly created CMS. Use the following command in the Lync Management Shell.

import-csConfiguration -FileName
filename

In my lab, the filename was TopologyBackup.ZIP

Enable the Topology
Next, use the following command to enable the topology we have just restored:

enable-csTopology

Install Missing Databases
We’re now ready to fire up topology builder. When you start it, you’ll get the normal options of download/new etc. - Select download as you would for an existing topology.

You should now see all of your servers & settings within topology builder, pre-destruction.

restore1

Before we can continue, we have to create any missing databases associated with the topology. To do this, right-click on ‘Lync Server 2010, and select ‘Install Database’.

restore2

You’ll then see which dedicated databases need to be created, with screens similar to this:

restore3

The system will then go off and create all of the relevant databases for you.

Publish the Topology
Once the database component has finished, use Topology Builder to publish the topology - I’m sure you know how to do that.

Install your Front End Server
You’re now at the point you would be if this were a fresh installation - so install your Front End server as per normal. I’m not going to run through doing that…

…but you essentially select the ‘Install or Update Lync Server System’ from the installation DVD:

restore4

Run the User Replicator
Once the server is built, services started, and it’s ready, you really need to ensure the user replicator has completed before you can do anything with the server. Depending on how many users you have in your system, it can take a while. You can check to see if it’s finished in the EventVwr by looking out for IDs 30024/30028 to tell you what’s happening. If you want, you can force a replication and watch out for the ID’s using the command:

update-csUserDatabase

Login to Lync!
Woo and indeed hop, your users should now be able to login…but what is this…where have all my contacts gone….? Ah, well, remember the dbimpexp we ran earlier to output the contacts/conference stuff? Well, we need to run the opposing command to import the good stuff back in to our new databases. We do that using the same DBIMPEXP tool, with the format like this for all users:

dbimpexp.exe /import /sqlserver:sqlserver /hrxmlfile:xmlfile /restype:user

So remembering I exported to ContactData.XML, and my SQL server/instance is dc1.small.local/Lync, the command would be:

dbimpexp.exe /import /sqlserver:sqlserver /hrxmlfile:xmlfile /restype:user

By the way, if you ever want to import contacts for just a single user, you can - modify the command format to:

dbimpexp.exe /import /user:sipaddress /sqlserver:sqlserver /hrxmlfile:xmlfile /restype:user

…I.e. include the /user parameter with the user’s SIP address.

….and we’re all good!
Told you it was (relatively) straight forward. What I haven’t covered here are:

  • Archive/Monitoring Databases. In the above scenario, we recreate new Archive & Monitoring databases. If you want, after the database creation stage, you can use SQL tools to restore those particular databases.
  • File Shares. You can use normal file backup & restore for those.
  • Response Groups. There are specific commands for backing up and restoring the response group databases - I’ll cover those in another article.

Video Run Through
…because I’m nice like that - the video below shows the whole thing end to end in my lab.






blog comments powered by Disqus