Category Archives: Powershell

Lync Call Concurrency Calculator

Sizing appropriate hardware, bandwidth, channels, etc. is one of key activity task during the design phase of any UC project. One value which is extremely important and help you size correctly is the concurrency level of any modality – Voice, Video, desktop sharing, etc. If you are deploying a new solution you would need the concurrency levels to size up the new environment. If you are not deploying the new solution you still require the concurrency levels for reporting/billing/bandwidth forecasting purposes.

Surprisingly, I have found getting concurrency levels (e.g. concurrent voice calls) from existing environment is pretty hard. It is something pretty straightforward to work out but either the customer doesn’t have any logging tool on their ageing PBX or the PBX vendor just don’t want to give any details which may help with Lync deployment. Even after you have Lync deployed there isn’t anywhere in the Lync Monitoring reports to tell you what concurrency levels are for any of the modalities.

Concurrency Script

Over the years I have developed various tools/scripts which I use to gather information during the design phase. One of this is the Concurrency Script. This is an extremely simple but very powerful PowerShell script. This script allows you to generate reports of what your Call Concurrency levels are not just for Lync but from PBX data as well.

All that script requires is an input of a CSV file which has StartTime and EndTime columns which essentially shows the date and time when the call started and when the call ended. The script processes this information and returns you the peak load at every minute/hour/day/week.

As the script is looking for just StartTime and EndTime, the concurrency is not limited to calls, you can calculate the concurrency of anything….literally, even something not related to Lync, PBX or even Voice!

The logic of the script is simple. The diagram below illustrates this very well:

Read More →

Lync Insights – Understanding your Voice Usage – Part2

This is a multi-part blog series. This is Part 2.For other blog posts in this series please click the relevant links – Part 1, Part 2.

In my last blog post I introduced you to Lync Insights module and some of the CQM queries and file transfers cmdlets. In this post I will cover some powerful cmdlets which will provide you deep insight into the usage of Voice within your Lync environment.

I would highly recommend you to read Part1 of the article as that lists the pre-requisites required for these cmdlets to run.

All Lync to Lync Calls
Get-LsP2PLyncToLyncAudio is the cmdlet you need for this. This cmdlet will show you all the calls between Lync users and whole lot of other information like the Edge server used, time of the call, Disconnect time etc.

All Lync/PSTN to/from PSTN/Lync Calls Read More →

Lync Insights – Answering the burning questions – Part1!

This is a multi-part blog series. This is Part 1.For other blog posts in this series please click the relevant links – Part 2.

After completing the Lync deployment don’t you in the back of your mind think I  wish I knew how Lync is being used, who is having issues, who is not using it, etc ? In fact, the burning questions, perhaps questions like these:

  • To which PSTN number highest number of phone calls are made
  • Who is on the phone for the longest duration (and who the least!)
  • When was the last time someone logged on to Lync
  • Find all the calls which are over certain thresholds e.g. over 10% packet loss, over 3ms Jitter, etc
  • Generate alerts when your boss makes a call and the call is not good quality e.g. Over 10% packet loss, over 30ms Jitter, etc
  • Find who is doing the most number of file transfers in your organization?
  • Find who is transferring what file and to whom?

Standard Lync Monitoring reports provides you with great information on several elements of Lync usage and health.But Lync Monitoring reports only scratches the surface of what information is actually available in Lync Monitoring database. Lync Monitoring database is a goldmine of information – unfortunately in spite of Microsoft publishing the database schemas I have barely seen anyone querying database directly.

In order to attempt to make the Lync monitoring databases more accessible and answer the above burning questions and I have created a Lync Insights PowerShell module. My idea is to include in Lync Insights all kinds of different SQL queries I use on day to day basis for various customers and share with ever growing passionate Lync community!

Read More →

Run Microsoft Exchange cmdlets offline

Couple of months ago I wrote about running Lync cmdlets offline. Being a Consultant this helps a lot as I can document and find about the customers environment without connecting to the live Lync environment. Extending the same concept to other Microsoft products which use Power shell (which means pretty much every Microsoft product esp. when PowerShell is part of Microsoft Common Engineering Criteria) is fairly straightforward.

In this post I demonstrate how you can access Exchange cmdlets offline.

The script allows you to execute Exchange cmdlets on your local machine (which may or may not have Exchange Management Shell). This is achieved by using XML files which are exported using export-clixml from Live Lync environment.

Script Pre-requisites
The script requires access to Exchange XML files generated using Exchange Management Shell. The files can be generated in couple of different ways. The generated filename should have the cmdlets name prefixed to it (eg: get-mailbox cmdlets filename should be get-mailbox.xml).

Below is a sample snippet you can use to export most of the Exchange configuration into XML Read More →

Disaster Recovery for Lync Survivable Branch Appliance (SBA)

Survivable Branch Appliance (SBA) is an appliance typically deployed in a branch site to provide resilience during WAN failures.

If your SBA does go down your users should have no loss of features (other than slight blip when they are disconnected from SBA and connected to the Lync Front End Pool). Although your users will only see a slight blip when SBA does fail it is important you bring the SBA online in case you have a WAN failure!

Consider a scenario where your SBA has gone down and you have determined its not usual things which has broken the SBA (firewall, AV updates, stopped services, specific updates, etc). Either you can continue to spend time on it to find the root cause, or go ahead and rebuild the SBA!

I am not suggesting you rebuild your SBA every time it breaks (SBA’s are actually pretty good and don’t fail often). You should find the root cause if your SBA is failing frequently but the quickest way to bring the SBA online  is by rebuilding it although it may seem drastic.

Rebuilding a failed SBA
To rebuild the SBA follow the steps below: Read More →

PowerShell Module for Sonus SBC 1000-2000

It’s finally here!!!! PowerShell module for Sonus SBC 1000/2000. Well it’s not an official one, but one I created out of necessity when managing numerous SBC’s.

Key Features

  1. Built-in cmdlets to query Sonus SBC for transformation tables, transformation entries, systems information, etc.
  2. Built-in cmdlets to create transformation tables and transformation entries
  3. Built-in cmdlets to reboot and backup Sonus SBC
  4. Extensibility – Query, create, modify and delete any UX resource even the one’s which don’t have cmdlets associated!
  5. Scalability – Manage Sonus SBC’s at scale. Query, create, modify and delete resources with extraordinary efficiency. 1 or 100 SBC’s, it doesn’t matter!
  6. Simplicity – Extremely simple to use, logical cmdlet naming and in-depth built-in help.


  1. Sonus SBC software should be R3.0 or higher
  2. PowerShell v 3.0 or higher
  3. Ensure you have applied the base version 3.0 license which contains the license for REST
  4. Ensure you have created a username and password for REST. For more details check out:

Getting Started

  1. Download the SonusUX PowerShell module from here Read More →

Automate Sonus SBC (1000/2000) Management using PowerShell

In previous blog posts I discussed about connecting and querying Sonus SBC using cURL. This article discusses how you can connect to Sonus using PowerShell v3. Please be aware the SBC is already on at least R3.0 and you have created a REST user account. More information can be found here.

Massive thanks to Adrien Pleiss from Sonus who provided most of the examples below.

Define variables

$uxhostname = “”
$uxusername = “restuser”
$uxpassword = “Password01”

Log on to SBC

$args1 = “Username=$uxusername&Password=$uxpassword”
$url = “https://$uxhostname/rest/login”
Invoke-RestMethod -Uri $url -Method Post -Body $args1 -SessionVariable ps
If the login is successful you will receive 200 OK message as below. If you do not receive 200 OK Read More →

Lync Front Pool Pre-Decommission Report

One of the tasks which I have to very oftenly perform is decommissioning old Lync pools (Lync 2010/2013) when moving to newer versions/pools. The whole Lync migration from Lync 2010/2013 to Lync 2013 is well documented and pretty straightforward. There are number of steps though which should be completed in order for a smooth migration. Before you decommission the pool it is a good idea to get a quick overview of how many objects (Users, UM objects, Common Area Phones, SBA’s, etc) are associated with the pool. In order to facilitate the decommission process I have created a Lync-PreDecom script. The script provides you information around all the Lync objects which are associated with the Lync pool you are going to decommission. You can run the script over and over again at any stage of migration to see what has been migrated and what remains. The screen shot below shows the kind of output you will see: In order to run the script all you have to provide is the Lync Front Pool name you want to decommission and new Lync Front Pool Read More →

Backup Sonus SBC (UX) 1000/2000 using PowerShell & REST API’s

As discussed in previous article the REST API license is provided free of charge to all Sonus SBC (UX) 1000/2000 customers with a valid support contract when upgrading to Release 3.0.This has opened whole lot of possibilities to manage Sonus devices programmatically which wasn’t available until now.

One area which has been very tedious was backing up Sonus devices on regular basis. As with other Lync components you do want some automated way to backup the Sonus configuration as well e.g.: once a day. Until now the backups (until you already had REST API license) were manual but with REST API’s licenses all that changes. Now you can quite easily include the backup of the Sonus SBC’s as part of the overall Lync infrastructure.

We will use cURL to backup Sonus SBC’s. Make sure you have gone through my previous article which shows how to setup and login to UX using cURL. To backup the Sonus device all you have to do is issue the following command:

.\curl.exe -s -k -i https://HOSTNAME/rest/system?action=backup –data “” –cookie COOKIE -o BACKUPFOLDER\BACKUPFILE –insecure’

Make sure you replace values in RED appropriately.

Well, using cURL is all well Read More →

Run Lync cmdlets Offline

Being a consultant it is often required to produce detailed design and implementation documents for customers. For various reasons it is not always possible to have access to customers network whilst completing this documentation. The script below addresses this issue. It essentially allows you to grab an offline copy of the Lync environment and invoke Get-cs* cmdlets.


The script allows you to execute Lync Shell (Get-cs*) cmdlets on your local machine (which may or may not have Lync Management Shell). This is achieved by using XML files which are exported using export-clixml from Live Lync environment. The script can be downloaded here

Script Pre-requisite

The script requires access to Lync XML files generated using Lync Management Shell. The files can be generated in couple of different ways. The generated filename should have the cmdlets name prefixed to it (eg: get-csuser cmdlets filename should be get-csuser.xml).

Below are the some of the example to output necessary XML files. These cmdlets should be run on Lync Server within Lync Server Management Shell:

Export only specific Read More →