List Lync Users – automated Excel file

(Have a look at the newer, smarter, prettier, fancier version of this script here.)

This script isn’t big news, but it’s very handy and easy to use.
It allows you to remotely connect to one of your pools and create an Excel sheet, populated with the following:

Display Name SIP Address Registrar Pool Enterprise Voice Line URI

It’s basically a list you can hand to your customers and colleagues so they can keep track of changes.
Additionally, it helps spot Enterprise Voice enabled users that don’t have a Line URI or it’s misconfigured.

When you run the script it’ll ask your for your Credentials – You must Have appropriate Lync permissions:

Credentials

It will then ask you for the FQDN of your Lync server or pool and will attempt to connect:

Lync Server

When connected, the script will immediately start creating the Excel file:

Creating Excel2

You can scroll up and down the Excel file but do not click anywhere on the spreadsheet. This causes the automated build to crash, and you’ll have to restart the script.

When completed, the script will notify you and close the remote PowerShell session it initiated.

Script Done

The pace is approx. a second per line, so if you have 5000 users this is the time to go and grab a cup of coffee.

The script can be downloaded here.

Updated October 7, 2014: Version 2.0 checks for your PS version. This script will only run on PS 3.0 or higher.

Advertisements

Lync not populating contact cards phone numbers from Active Directory (Or: How to normalize AD phone numbers for Lync Server 2010 and 2013)

** This article also works for Lync Server 2013!

 

You’ve seen it. The contact card in Lync shows you everything you entered in Active Directory, except for phone numbers. even when you know you have them there!

This can be quite frustrating, especially if you’re not yet connected with enterprise voive and clients want to pull all the relevant information from Lync during an IM session, including the other side’s phone numbers.

Here’s what you get:

Instead of seeing the relevant phone numbers from Lync like here (sort of…)

You’re getting a card that has no phone info what so ever:

As you can see, ‘test’ Springsteen here, has no phone info in his contact card.

Let’s take a look at Active Directory, see what’s configured there:

This can’t be right! All the information is there! Home, Mobile, even the Office phone is there.

How can we resolve this issue, even without implenenting Lync Enterprise Voice?

Let’s take a look at the event viewer to get some help.

If you scroll down the Lync server logs in event viewer, you’ll probably see event number 21034 generated by LS Address Book Server. It will tell you something like this:

“One or more phone numbers failed to normalize.

‘X’ total numbers failed to normalize.  They are listed in the text file: ‘\\<Lync Server Name>\<Lync Share>\1-WebServices-1\ABFiles0000000-0000-0000-0000-0000000000000000000-0000-0000-0000-000000000000\Invalid_AD_Phone_Numbers.txt’ Cause: One or more phone number attributes in Active Directory contained text that could not be normalized.  Normalization rules are contained in the optional Company_Phone_Number_Normalization_Rules.txt file located in the output location or in the generic rules built into Address Book Server.  Refer to the documentation for a description of the built-in generic normalization rules.  Use the ABServer -dumpRules command to see all the rules that Address Book Server is currently configured with.”

It looks like this:

If you press the path in the event propertis or browse to the file location in your server (always in the same place, in the same name), you will see the following:

What you get here is a list of the users and they’re phone numbers you thought were ok.

Why is this happening?

Well, Lync expects all the phone numbers in your AD to be in the E.164 format, meaning they should be +1-111-11111111 etc. If they’re not like this (as the example above shows us), you will have to normalize them if you want Lync to publish them.

How can I fix this?

Quite easily, to be honest. If you continue reading in event  21034, you’ll see the following:

“Either create a Company_Phone_Number_Normalization_Rules.txt file in the output location and make sure it covers all cases found in your Active Directory deployment or fix the invalid phone number(s) in the Active Directory record(s).”

You get a free advice – you don’t throw it away, do you? What Lync actually tells you, is to create  a file called “Company_Phone_Number_Normalization_Rules.txt” in the root of the AB folder of your Lync shared folder (Not in a sub folder, not by a different name, EXACTLY this one) – like it shows you here:

In this file, you must enter normalization rules according to your country code and other variables.

I used to freak out when I heard normalization rules, but fortunately the guys at Lync made it quite simple for us: I use the Lync Server Control Panel to generate and test my normalization rules. It’s really easy and fun to use – Just enter the details and copy the results. In the next example I created a rule to normalize our internal numbers:

I copied the “Pattern to match” and the “Translation Rule” from the wizard and copied them one line below the other (in the order they appear at the wizard) to the txt file I created. Note you can add “##” at the beginning of each line if you want to write comments.

This is how my file looks like at the end:

Now, all I have to do is run the “Update-CsAddressbook” command from Lync Management Shell and that’s it.

If you configured the rules correctly – you will see the results in your clients. It might take a while for the clients to download the updates, but eventually you’ll see it works perfectly:

Now you can call Bruce 🙂