One Liner – See Number Of Connected Users, Endpoints On A Lync Front End Server
A question went around an internal DL at work today asking if anyone knew off the top of their head the name of performance counters that show connected users and endpoints. While digging up the answer, I started thinking – this would be a great little one liner.
My esteemed colleague Ron Cook (@roncook925) beat me to supplying the answer to the DL question. The two counters are:
LS:USrv – Endpoint Cache\USrv – Active Registered Endpoints
LS:USrv – Endpoint Cache\USrv – Active Registered Users
Endpoints is always higher than users, in my experience. There are always some users who are connected via mobile devices and rich client, or via OWA, or LPE. So I like to query both.
PowerShell has a great cmdlet called Get-Counter which, as you can guess, can query performance counters. There’s a pretty good tutorial on how to retrieve perfmon counter data for Lync related counters by the Lync PowerShell group at Microsoft in How Do We Love Performance Counters” Let Us Count the Ways. So let’s take a look at how we can get the data we need.
In this case, we’ll query the two counters mentioned above with one line. This is supported in Get-Counter by just separating the counters with a comma. We’ll select an expanded property called CounterSamples, which holds the data we need (among other info). And lastly, we’ll output the path (counter name), and something called the CookedValue, which is the actual counter value contained within CounterSamples. I know, CookedValue sounds like it could be just made up numbers, like those you get from a shifty accountant. But it is truly the value we want.
Plug this into your console as one long line:
Get-Counter "\LS:USrv - Endpoint Cache\USrv - Active Registered Endpoints","\LS:USrv - Endpoint Cache\USrv - Active Registered Users" | Select-Object -ExpandProperty CounterSamples | Format-Table Path,CookedValue -Auto
That will give you a quick point-in-time snapshot of the number of users and endpoints connected to the front end, as shown below.
The blurred text is just the front end name. If you’d like to query a remote front end, just tack on the ComputerName parameter, such as:
Get-Counter "\LS:USrv - Endpoint Cache\USrv - Active Registered Endpoints","\LS:USrv - Endpoint Cache\USrv - Active Registered Users" -ComputerName frontend.contoso.com | Select-Object -ExpandProperty CounterSamples | Format-Table Path,CookedValue -Auto
For those wondering why I’m using Format-Table and the -Auto parameter, it’s because the counter path value is so long that it would otherwise get truncated short enough to where you wouldn’t know which counter was tied to which value.
Love it, Love it, Love it!!! Now how do you get it to query a pool as opposed to an Idividual FE?
Have you looked at my Get-CsConnections script? https://www.ucunleashed.com/269
Are those counters available to check number of connection on the Edge Server? Or do you know any other way to know the number of connections coming through the Edge pool?
In perfmon add the counter LS:SIP Networking – SIP Unique users connected directly. In powershell it’s “Get-Counter -counter “\LS:SIP – Networking\SIP – Unique users connected directly”.
Hi, Thanks for this article because I used LS:USrv – Endpoint Cache\USrv – Active Registered Users to monitoring my FE servers and it works fine. Thx a lot ! Now I would like to do the same for EDGE server but I don’t see the counters indicated above. For Lync 2013 in the past I created Splunk dashboard using sip_-_unique_users_connected_directly but this counter is not present in the new Skype2015 servers. Do you know other couters that I can use to monitoring them and to display how many users are connected trought edge servers ? thanks !