Sunday, January 5, 2014

Restoring based on Lync 2013 Backup script. Part 1

Disaster recovery?
Have you tried my Backup Script at the Technet Gallery, but now you're wondering what to do with the backup? How do you restore ? What goes where and why?

This is the first of four blog posts trying to explain a couple of concepts regarding backup.

Let first begin with the #1 question on Twitter, this blog, in person or in mail:
"Can you write a restore script for your backup script?"
Short answer:
No
Longer answer, and an explanation: The reason why I will not write a single script, is because every disaster is different, so every restore must also be different. You do not always need to restore every thing the same way you need to back op every thing.
You will probably notice my restore posts will be more of guidelines, and where to find more information, than actual "how-to's". It is more important to know what you've just made a backup of, than to be able to run a restore script.
Now, if you feel you have an idea for a restore script, please feel free to create a script or contact me if you feel like collaborate on such a script. But as of now, I don't see an easy way to it. As I said, there are so many different ways you may or want to make a restore.

The Basics:
Before I begin, I want to point out a couple of dependencies in the infrastructure my script will not help you with, and these are as well as important as the Lync infrastructure itself. In order to have a full and healthy backup, please also consider back up / restore routines for some of the following infrastructure elements:

  • Active directory (schema, objects and everything that goes with it)  
  • DNS (Internal and external)
  • DHCP
  • PKI (Internal Certificate Authoroty) Infrastructure
  • File servers (Not the shares, but the actual servers)
  • SQL Server (Not the Lync database, but the server running SQL software. How do you restore if your SQL server dies?)
  • Lync server backup (OS, physical or virtual machines needs restore too, sometimes)
  • Exchange Backup (Servers, configurations, databases and more)
  • Firewall configurations
  • Routing configurations
  • Switch configuration
  • Installation media for Server, SQL, Lync, Clients and more (I know it can be downloaded, but include this in your recovery-plan, Internet might be gone at the point of recovery)
There are probably other elements as well, but these are the important ones I remember right now. I will add items to the this list if something come to my attention ;)

Now then, let's talk about files from the script. I'll try to section it down by the name of the output file, so it will be easier to recognize when you look at your backup files and wonder what goes where. Next I'll talk about the actual command used to create it, and refer to the technet description of the commands I used. I'll also try to point you in the direction where you can read more about restoring the information contained in the file. 

CsConfiguration.zip
The first actual piece of backup done in my script, is copying the configuration to a zipfile:
export-csconfiguration -filename $backupfile1  -Verbose
If you have deployed an edge server or two, you'll recognize this command as a part of the deployment process if the edge server is not a member of the domain, and can not reach the rest of the topology (as it should be).

What you might not realize is that this single file contains a piece of the heart of the Lync topology. In it is information about the topology, policies and configuration setting. It can be used to deploy an edge server, restore an edge server, restore central management store, or as I use it; restore a Lync server "offline" (not in the network) and prepare to restore it into the network.

You can restore the topology by running the "import-csconfiguration -filename csconfiguration.zip". Or use "import-csconfiguration -filename csconfiguration.zip -localstore" just to update a local computer not in contact with the rest of the topology (dmz or offline).

Topology DATE.xml
The next backup done is that of the Topology:
(Get-CsTopology -AsXml).ToString() > $backupfile12
Although not the "recommended" way to restore your topology, I have found this a nice way to republish a known functioning version of the topology when "someone" has done "something" and "nothing" works.

You can at least read the XML file, and go through and compare your domains, sites, and computers running Lync Server services and server roles. This single file has been my (and some of my customers savior) on more than one occasion.

A way to republish this information is to use the "publish-cstopology" command. The link provided shows both how I extracted the information, and how to republish.

Be warned: This is not the recommended way to do things, but the information here may still be handy in certain situations, and is why I included it.

That's all for now, I will continue with more posts on the subject of restoring with the information from my backup in the future, so stay tuned!