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.

11 Responses to “Counting Enterprise Voice enabled users on a specific pool in Lync”

  1. Scott says:

    Wow that’s handy. Can actually make use of that where I’m working now. thanks.

  2. Pat Richard says:

    -OnLyncServer isn’t needed if you’re targeting a specific pool.

  3. Pat Richard says:

    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.

  4. Bara says:

    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.

  5. […] Counting Enterprise Voice enabled users on a specific pool in Lync […]

  6. Abhijeet Kasurde says:

    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.

  7. Nick says:

    I ran the above suggested cmdlt and did not get anything back. just an empty prompt.
    any idea?

  8. Rob Armstrong says:

    This worked better for me:-

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

Leave your comment

Please fill your data and comment below.
Your comment