Automating Lync 2010 Backups

The backup procedure for Microsoft Lync Server 2010 can be a little daunting as the process is extremely manual. When working with clients I typically deploy a scheduled task on a front-end server to help automate where possible. Backups of SQL (either with a SQL aware backup program or locally to disk) and of the Lync Share are still required as well but at least this covers the rest of the items.

The script is simple but two part – it starts in the command prompt and then calls out PowerShell modules and a PowerShell script to wrap things up. Some manual purging of previous backups is done first and then the current backups are performed (where necessary). The example uses the following variables:

  • Scripts are located in D:\Scripts
  • Backups are dumped to D:\Backups
  • Create Subfolders under Backups - Config, DBIMPEXP, LIS, RGS
  • Lync 2010 Resource Kit is local and installed to D:\Program Files\Microsoft Lync Server 2010\ResKit

LYNC_BACKUP.CMD

del D:\Backups\Config\config.xml
del D:\Backups\LIS\lis.xml
del D:\Backups\RGS\rgs.zip

"C:\Program Files\Common Files\Microsoft Lync Server 2010\Support\DBImpExp.exe" /hrxmlfile:D:\Backups\DBIMPEXP\Backup.xml /sqlserver:YOUR_SQL_SERVER_FQDN_and_INSTANCE

C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -command "cd $env:UserProfile; Import-Module 'C:\Program Files\Common Files\Microsoft Lync Server 2010\Modules\Lync\Lync.psd1'; Import-Module 'D:\Program Files\Microsoft Lync Server 2010\ResKit\RgsImportExport.ps1'; D:\Scripts\lync_backup.ps1

Exit

LYNC_BACKUP.PS1

Export-CsConfiguration -FileName D:\Backups\Config\config.xml;
Export-CsLisConfiguration -FileName D:\Backups\LIS\lis.xml;
Export-CsRgsConfiguration ApplicationServer:YOUR_POOL_SERVER_FQDN –FileName D:\Backups\RGS\rgs.zip;
exit

To automate the tasks create a Scheduled Task on a Lync Front-End server and schedule the task with a service account that has full NTFS permissions to the D:\Backups folder (and subfolders/files), is a member of the RTCUniversalServerAdmins group, and has Log on as a batch job rights.

Create Scheduled Task

  1. Launch from the Administrative Tools Task Scheduler
  2. Click the Task Scheduler Library and right-click to Create a Basic TaskName the task – Lync Backups (as an example)
  3. Create a schedule – this needs to mimic your local backup jobs so that the daily/weekly/etc. backups gather the backups you create (in the example we used Daily at midnight
  4. Select to Start a program and select the CMD file created above
  5. Finish the task creation and then double-click the task to edit it further
  6. Modify the Security
  7. Set to run whether user is logged in or not
  8. Set the user execution task to the Lync Service account created above
  9. Save the task entering the password when prompted and you are done

Testing of the task may be completed by right-clicking on the task and selecting Run. Don’t forget to backup the D:\Backups directory as well as the SQL databases and Lync share to gather all Lync info.

Additional References

http://technet.microsoft.com/en-us/library/hh202170

Receptionist 'Night-mode' in Lync 2010/2013

During deployments of Lync we are often asked to mimic existing PBX solutions where possible. Initially deploying Lync as near identical to the existing solution reduces adoption rate and allows new and exciting feature to be slowly introduced. One of the features that are often requested is 'night-mode' by the company's receptionist. It is not uncommon that at the end of the day the receptionist will simply dial a specific code diverting all incoming calls to the afterhours message and the reverse at the start of their business day.

A similar solution, ideally utilizing a response group for added functionality (although a simple voicemail box would work as well), can be setup within Lync. The changes are visual rather than a calling code but otherwise the solution works as it did.

The original call flow would be something like:

During Business Hours
PSTN caller à Main Number à Receptionist Phone Rings

After Business Hours
PSTN caller à Main Number à Afterhours Message/ACD

For this solution to work as expected we start with a few simple requirements:

  1. Lync 2010 is deployed with Enterprise Voice
  2. The Lync Attendant or Lync Client is utilized
  3. Exchange 2010 Unified Messaging is deployed
  4. A Lync Response Group, Exchange Auto Attendant, or Exchange Unified Messaging Mailbox is the destination when calls are not answered.

That’s it! Nothing too fancy! Now we get to configuring the client.

We will the assumption that there is a Lync Response Group that exists to field unanswered calls to the main number. This RGS is configured as follows:

Internal caller à Main RGS à Decision Tree à Exchange Unified Messaging

Alternatively we could use an Exchange Auto Attendant or a Lync Announcement Service but for this example we will stick with the Lync RGS.

To create the Lync RGS we start with the Lync Control Panel and J work Right-to-Left.


The Group may contain one or more ‘real’ users but as long as it contains a user this will work. I typically will provision a dummy user – an EV enabled user without a TEL URI that I can place in this group. The purpose of the dummy user is to simply have them always signed out so that the RGS moves through its logic quickly.

We start by clicking on the Response Group section within the Lync Control Panel, then Group, the New.


Select the Application Server that the Group will be hosted on and click OK. Within our new Group we must give it a name and configure the settings. For this example we will configure it with a name of NightModeGroup with a dummy agent.


We then move to then next tab on the left and create a Queue. The Queue defines what happens when a call is received in the Queue, to whom, timeouts, and next hops. Again we start by clicking New on the Queue tab, selecting the same Application pool we selected when making the Group and clicking OK.

We called the Queue NightModeQueue but you can name it whatever you wish. Click select under Groups to bring up the dialog box with the groups and select NightModeGroup. Because we want the call to eventually terminate somewhere we have enabled the queue time-out and selected voice mail as the destination. A previously Unified Messaging enabled mailbox would need to be setup and in this case I have identified the mailbox as Main (sip:main@domain.com;opaque=app:voicemail). As shown below.


Now that our Group and Queue have been created we can move to the Workflow or RGS itself. Moving along the tabs at the top to the left we select Workflow and then click Create or edit a workflow (you can bookmark and go directly to this link). This selection launches a web browser where the workflow is actually created. Again, make sure the application pool that is selected is the same pool where the Group and Queue were created.

The Response Group Configuration Tool is where workflows are created, modified, and removed. A fancy Interactive workflow could be created but for the purposes of this example we are going to do a simple hunt group. Click Create next to Hunt Group to launch the wizard.


The Hunt group can be used to play a message and hold music while it attempts to locate a person. In our use, the person in question is offline so it will immediately flow to voicemail after the 10 second timeout. Had this been an Interactive it could have presented options for calling someone by name (passing the call to Exchange Unified Messaging), ringing a department, or even an afterhours operator.

We filled out the form with basic information giving the TEL URI a non-DID so that it could not be reached from the outside, and placed our main number as the Display Number. Remember, do NOT use the main number here as that number will be assigned to an account name receptionist – this workflow is only a rollover number.


Next we select our main language and configure a Welcome Message. Ideally the welcome message is a pre-recorded WAV file but in this example we are utilizing the text-to-speech engine. You may also skip this step and simply record the message on the Voice Mailbox if that is where the call is going.


You will also notice we left our business hours as working 24x7. This is important as we want the workflow to run anytime it is reached and it should never be reached unless we are unavailable. Because of this, we can also skip the holiday hours settings moving us to the queue selection.


From the drop down select the NightModeQueue and click Deploy to create the RGS. The process is near immediate, but may take up to 5 minutes to become functional. If the number you entered was not a valid routable number you can call the number by normalizing the number manually within Lync – simply enter +5000 within Lync and you should be able to call into the queue.

Now that we have the afterhours destination configured we can move to the client settings. There are two main configurations that we will want to make within the Receptionist client. As a reminder the receptionist account has the following properties:

  1. Usually a shared account that all users who cover the front desk know how to login/out OR the computer the Receptionist is logged into is never logged out.
  2. The computer where the Receptionist is logged into with Lync is dedicated. This is especially true when the Lync Attendant Console is used
  3. The main number is set to the Receptionist within Lync Control Panel

The configuration for the night mode is completed under the call forwarding section of Lync. This can be accessed in multiple ways but the simplest is to simply click the drop-down Call forwarding settings here and select Call Forwarding Settings.


With call forwarding turned off, we want to set the unanswered calls to the RGS previously created. To do so, simply click the hyper-link next to Unanswered calls and select new Number or Contact. Enter +5000 as the new number and click OK. The default timeout is 20 seconds or approximately 4 rings – adjust as necessary. With this setting, should the Receptionist not get to her phone within the 20 second timeout, it would ring to the afterhours number. This also ensures that if the evening forwarding is forgotten calls will still reach the afterhours greeting (with an additional 20 second delay).

With the +5000 number being entered as the unanswered number it is now quickly available for forwarding. This allows the Receptionist, at the end of the day to simply quickly select the Night Mode from the call forwarding settings. Simple drop down the call forwarding option, select forward calls to and select +5000. In the morning, selecting Turn Off Call Forwarding turns off the ‘Night Mode.’

There are all types of scenarios that can be addressed with Microsoft Lync when it comes to voice and the PBX replacement – knowing the features and maximizing their options is where things are key. In this example we used the power of call forwarding, Response Groups, and Exchange Unified Messaging. Remember, Interactive Response Groups and the Announcement Service could be used as well as a simple forwarding to a voice mailbox.