Archive for the 'Powershell' Category

02 DecUnderstanding Lync 2013 Branch Site Voice Mail Survivability

Recently I was working on a customer’s global roll-out of Lync 2013 and we were designing how their branch sites would work from a voice perspective. Each branch site would have an SBA for voice connectivity to the legacy PBX/ISDN and for survivability, but we also had to map out how voice mail would work in the event of WAN failure.

Here’s how things would look like in a normal scenario with the WAN up:

vm reroute

With the Exchange Unified Messaging servers being in the central data centre along with the main Front End pool, this meant we needed to configure voice mail survivability. This is a feature Lync 2013 provides out of the box, but not one I knew a lot about or how to configure it. Outlined at the bottom of the TechNet Library article Branch-Site Resiliency Requirements, we can determine how Lync still provides voice mail deposit and retrieval in the event that the SBA cannot contact the central Exchange UM server/s. Read more…

03 MayCounting Enterprise Voice enabled users on a specific pool in Lync

Here’s some Friday Powershell fun for you. Today I needed to retrieve a count of voice enabled users in a Lync environment for reporting purposes. Obviously I turned to a bit of crafty cmdlet action, and sought to see what I could put together using Get-CsUser.

Getting just a number

After some quick searching, I found Chris Norman‘s helpful post on Counting Enterprise Voice Enabled Users in Lync. His Powershell example got me half of the way there, and gave me the syntax to just retrieve a number of users rather than an endless list of users and their details.

So taking Chris’ example of  (Get-CsUser -OnLyncServer -Filter {EnterpriseVoiceEnabled -eq $true}).count (don’t forget the brackets on each end), I was able to put together the first part of what I needed. I then needed to narrow this down to a particular pool because there were lots of Front End pools in this environment and we only wanted to get the number of EV enabled users from one local pool.

Narrowing down to a specific Front End Pool

I needed to specify additional filters in the cmdlet but couldn’t remember how (my mind is probably thinking more about a beer after work on a Friday afternoon). Some more searching lead me to my own post on How to retrieve all users with a specific country code in Lync where I already had an example of how to specify additional filters.

Using Chris’ cmdlet, I added -and RegistrarPool -eq “PoolFQDN” to the end and voila, I had my user count.

So the full cmdlet I used looks like this:

(Get-CsUser -OnLyncServer (Update – Pat Richard informs me that this switch isn’t necessary because the Pool FQDN is specified) -Filter {EnterpriseVoiceEnabled -eq $true -and RegistrarPool -eq “PoolFQDN”}).count

e.g. (Get-CsUser -Filter {EnterpriseVoiceEnabled -eq $true -and RegistrarPool -eq “pool01.contoso.com”}).count

Using this cmdlet, I was able to retrieve just a count of EV users on one pool. No long formatted list/table of SIP addresses, OUs etc that Get-CsUser usually retrieves, or an inflated number from every pool in the environment.

Quick and simple. Hope this helps you out at some point as well.

14 NovHow to retrieve all users with a specific country code in Lync

Recently I came across a scenario where I needed to retrieve a list of all voice users on OCS 2007 R2 with a French phone number using Lync Server Management Shell (LSMS). It took me a bit of work and help from scripting guru and fellow Modality consultant Tom Arbuthnot, but I ended up getting something sorted that did what I needed.

Building the Base Cmdlet

Based on the fact that French phone numbers begin with +33 in the number string and the users we need to find are on OCS 2007 R2, this gives us two requirements to get our LSMS cmdlet going.

The first switch we apply in the Get-CsUser cmdlet is -OnOfficeCommunicationServer to search for users on legacy pools (OCS 2007 or OCS 2007 R2).
The second switch we apply is the -filter switch followed by the user attributes we want to filter by. We also need to specify whether we want to match exactly (e.g. EnterpriseVoiceEnabled -eq $true) or search for a string like what we specify (LineURI -like “tel:+33*”).

So initially, we produce this cmdlet in LSMS with the appropriate filter to search for Enterprise Voice enabled users with a Line URI starting with tel:+33:

Get-CsUser -OnOfficeCommunicationServer -Filter {EnterpriseVoiceEnabled -eq $true -and LineURI -like “tel:+33*”}

This cmdlet will give you a list of users with French phone numbers but will also list heaps of info like the users’ client policy, voice policy, yada yada yada, which we want to get rid of.

Cutting out the fluff

I just wanted the names and numbers of our French users, so I modified the command to just show me this info by piping the cmdlet to a formatted table with only the properties I wanted to see:

Get-CsUser -OnOfficeCommunicationServer -Filter {EnterpriseVoiceEnabled -eq $true -and LineURI -like “tel:+33*”} | ft -property DisplayName, LineURI

This cmdlet will give us the same information again, but will give us a nice looking table with just the DisplayName and LineURI attributes that we want.

This will print the search results out in your current LSMS session, however if you’d like to export these out to text file to send via email, run this command:

Get-CsUser -OnOfficeCommunicationServer -Filter {EnterpriseVoiceEnabled -eq $true -and LineURI -like “tel:+33*”} | ft -property DisplayName, LineURI | Out-File C:\voice_users_export.txt

Your list of users will then be exported out to file to the path you specify after Out-File.

Taking it further

You can take this cmdlet and do a few other things also based on your requirements. Like if you’d like to get users on Lync Server rather than OCS, change the switch in your command from -OnOfficeCommunicationServer to -OnLyncServer e.g.

Get-CsUser -OnLyncServer -Filter {EnterpriseVoiceEnabled -eq $true -and LineURI -like “tel:+33*”} | ft -property DisplayName, LineURI | Out-File C:\voice_users_export.txt

Obviously you could modify this to retrieve users with all other kinds of numbers also. Just change the +33 to the country code assigned to your Enterprise Voice enabled users to whatever other country code you need.

Hope this command or a part of it helps you with your voice documentation/ investigation work on Lync/OCS 2007 R2.