Counting 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.

11 thoughts on “Counting Enterprise Voice enabled users on a specific pool in Lync

  1. Pat Richard

    Just as an FYI, Lync 2013/PowerShell v3 doesn’t like trying to filter on RegistrarPool. A version that will work in both versions would be
    (Get-CsUser | ? {$_.EnterpriseVoiceEnabled -and $_.RegistrarPool -match “[Pool FQDN]”}).count

    You don’t have to see if EnterpriseVoiceEnabled is true – merely that it exists. If it does, it’s $true.

    Reply
  2. Bara

    You could also group by the RegistrarPool to get a count for all pools:

    Get-CsUser -Filter {EnterpriseVoiceEnabled -eq $true} | Group-Object RegistrarPool

    to get a count for all pools.

    Reply
  3. Pingback: Lync MVP Article Roundup: May 2013 - NextHop - Site Home - TechNet Blogs

  4. Abhijeet Kasurde

    PS C:\> Get-Csuser | where-object {$_.EnterpriseVoiceEnabled -eq $true} | selec
    t name,samaccountname,lineuri | Export-Csv d:\enterprise.csv
    Try this Script which will give you Usernames with LINE URI.

    Reply
  5. Rob Armstrong

    This worked better for me:-

    (get-csuser | ? {($_.registrarpool -eq “PoolFQDN”) -and ($_.enterprisevoiceenabled -eq $true)}).count

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.