Home > Lync Server > Script: Get-CsConnections.ps1 – See User Connections, Client Versions, Load Balancing in Lync Server

Script: Get-CsConnections.ps1 – See User Connections, Client Versions, Load Balancing in Lync Server

Lync 2013 logo 128x128Tracy A. Cerise and Mahmoud Badran came up with a script to show Lync connections, and the users connected. This was quite informative as it could be used to show load balance distribution, client versions being used, and more.

I took the script and updated it a little, including:

  1. Removed the help function and the header block and inserted comment based help. So a user can run get-help Get-CsConnections.ps1 and get the help, just like any other script and cmdlet.
  2. Added a parameter to display the user list. My needs didn’t require the user list – just the statistics at the beginning. So I added the feature to show the user list by running Get-CsConnections.ps1 –IncludeUsers.
  3. Added a couple of functions, including one that cleans up some variables when exiting.
  4. Adjusted some of the formatting. I noticed things didn’t always line up when the server FQDNs were really long, like those in child domains.
  5. Did a prereq check to verify the Lync module is loaded. If not, it gets loaded. That way, the script will still run fine if it’s run from an ordinary PowerShell console.
  6. Accounted for the pool parameter being just a NetBIOS name by adding the $env:userdnsdomain to the NetBIOS name to create the FQDN. This appears to work fine if the Lync servers and user running the script are both in the same domain. If not, then an FQDN would be required.
  7. Renamed the script to Get-CsConnections.ps1 and some of the functions to the normal verb-noun format.
  8. Added a feature to show just a specific client version number, and the users connected with that client version. This can help you determine who is connecting with what versions, which is helpful when looking into licensing, upgrades, etc.
  9. Added support for Lync Server 2013, which uses a different query than Lync Server 2010.
  10. Tons more info in updates and releases following that. See the changelog for more info.

Syntax

Get-CsConnections.ps1 [[-Pool] ] [[-SIPAddress] ] [[-FilePath] ] [-IncludeUsers] [-IncludeHighUsers] [-IncludeSystem] [[-UserHighConnectionFlag] ] [[-ClientVersion] ] [-ShowFullClient] [ShowTotal] [[-Server] ] [-WhatIf] [-Confirm] []

Run the script specifying the front end pool or server to target:

Get-CsConnections.ps1 -Pool [pool FQDN]

or

Get-CsConnections.ps1 -Server [server FQDN]

The script automatically determines the version (2010 or 2013) of the pool, and uses the correct query.

If I can find an auto-detect method for server versions, I’ll include that in a later build.

Will show you unique client versions, their user agent, and the number of connections for each:

Current connected users listed by client name/version

Current connected users listed by client name/version

Distribution of connections across frontend servers (load balancing):

Connections by server (load balancing)

Connections by server (load balancing)

The number of unique users and clients connected:

Total unique users and clients

Total unique users and clients

And, adding the -IncludeUsers switch, such as:

Get-CsConnections.ps1 -Pool [pool FQDN] -IncludeUsers

will also show the users who are connected, and the number of connections they each have:

Connections per user

Connections per user

Using -IncludeHighUsers instead of -IncludeUsers will only list those users who meet the UserHighConnectionFlag (shown in white) or exceed the UserHighConnectionFlag (shown in red).

Get-CsConnections.ps1 -SipAddr [sip address] -Pool [pool FQDN]

Will show you the information for a single user:

Connection info for a specific user

Connection info for a specific user

Get-CsConnections.ps1 -Pool [pool FQDN] -ClientVersion [version number]

Will show the connection data for just that version number, including listing the users connected with that client version. This is helpful if the first method lists some version numbers you’d like to track down. Here, I used a client version of 13.1. MC/13.1.x is the OCS client on the Mac.

Connections by client version

Connections by client version

Using the -ShowFullClient option will show extended info for client name/version. However, the previous ‘Client Version’ column is not shown due to formatting restrictions. Here we can see more info, especially about mobile devices, Lync Phone Edition, and Mac clients.

Show Full Client extended info

Show Full Client extended info

Using -ShowTotal will also add additional info to the bottom section, including total number of users who are Lync enabled, total who are voice enabled, and percentage of total Lync enabled users who are connected.

ShowTotal option with totals and percentage

ShowTotal option with totals and percentage

You can export the info to a .csv file for viewing/manipulation in Excel using:

Get-CsConnections.ps1 -Pool [pool FQDN] -FilePath [path to csv file]

Installation

Execution Policy: Third-party PowerShell scripts may require that the PowerShell Execution Policy be set to either AllSigned, RemoteSigned, or Unrestricted. The default is Restricted, which prevents scripts – even code signed scripts – from running. For more information about setting your Execution Policy, see Using the Set-ExecutionPolicy Cmdlet.

NOTE: In order to gain remote access to each Front End server’s RTCLOCAL database where connection information is found, you need to open two local firewall ports; one static UDP port (1434), and one dynamic TCP port. We can use netsh to open the two required ports. First, open an elevated command prompt, and paste the following line. You should get “Ok.” in return:

netsh advfirewall firewall add rule name="SQL Browser (UDP 1434)" dir=in action=allow protocol=UDP localport=1434 profile=domain description="Created for Get-CsConnections.ps1. For more information, see http://www.ehloworld.com/269"

Next, find the dynamically assigned port used by the Named Instance (RTCLOCAL):

  • On the Front End server, open SQL Server Configuration Manager.
  • Expand SQL Server Network Configuration.
  • Click on Protocols for RTCLOCAL.
  • On the right side, right click on TCP/IP, and choose Properties.
  • Click on the IP Addresses tab.
  • Scroll to the last section, called IPAll.
  • Note the TCP Dynamic Ports value

IPAll

Replace [dynamic port] in the code below with the dynamic port number, and run the entire following command:

netsh advfirewall firewall add rule name="SQL RTCLOCAL Dynamic Port (tcp-in)" dir=in action=allow protocol=TCP localport=[dynamic port] profile=domain description="Created for Get-CsConnections.ps1. For more information, see http://www.ehloworld.com/269"

If you look at the inbound rules for the firewall, you’ll now see the two new rules:

fwrules

Repeat the process for both ports on each Front End server.

Note: The dynamically assigned port is unique to each Front End server, not the pool. So you’ll need find the value on each server. Once the two ports are open on each Front End server in the pool, the script should work fine.

Thanks to James Cussen for explaining what config is needed for SQL access through the firewall.

Download

v2.9 – 10-28-2014 – Get-CsConnections.v2.9.zip

v2.8 – 06-10-2014 – Get-CsConnections.v2.8.zip

v2.7 – 05-24-2014 – Get-CsConnections.v2.7.zip

v2.6 – 02-08-2014 – Get-CsConnections.v2.6.zip

v2.5 – 11-26-2013 – Get-CsConnections.v2.5.zip

v2.4 – 09-13-2013 – Get-CsConnections.v2.4.zip

v2.3 – 08-01-2013 – Get-CsConnections.v2.3.zip

v2.2 – 05-10-2013 – Get-CsConnections.v2.2.zip

v2.1 – 12-13-2012 – Get-CsConnections.v2.1.zip

v2.0 – 10-16-2012 – Get-CsConnections.v2.0.zip

v1.9 – 09-21-2012 – Get-CsConnections.v1.9.zip

v1.8 – 09-14-2012 – Get-CsConnections.v1.8.zip

v1.7 – Get-CsConnections.v1.7.zip

v1.6 – Get-CsConnections.v1.6.zip

v1.4 – Get-CsConnections.v1.4.zip

v1.3 – Get-CsConnections.zip

v1.0 – Get-CsConnections.zip

Changelog

See the changelog for a complete list of features added in each release

  1. Craig
    January 20th, 2012 at 15:11 | #1

    Thanks for the script. Is it possible to show which users/connections are connected via the edge server? Mainly on the -includeusers output if you could show FE Connection – Edge Connection that would be nice. Thanks

    • Pat Richard
      January 21st, 2012 at 08:02 | #2

      That’s on the wish list for that script.

      • June 15th, 2013 at 08:25 | #3

        Hi Richard,
        Any changes to support the Edge connections ?
        Thanks

        • Pat Richard
          June 15th, 2013 at 10:22 | #4

          It already shows people connected through edge. It just don’t differentiate them. Not likely to, either. Not sure there is a way to tell based on querying SQL on the FEs.

          • December 16th, 2014 at 18:58 | #5

            At one point I wrote a web app based on Snooper66’s Find Lync versions SQL query and recall this being called isEdgeConnection there, but not sure if that was his name, or from the RTCLOCAL DB

  2. John
    February 15th, 2012 at 00:55 | #6

    Hi Pat,

    Thank you for an excellent script.

    Is it possible to show the hostname or IP address of the client connection? This would be a great help in tracking down machines running older client versions.

    Thanks.

    • March 18th, 2012 at 05:24 | #7

      Hi John,

      Yes, isn’t this a BRILLIANT script?!?!

      I’m with you – a list of client IP addresses would be a VERY handy thing to have.

      I’ve had a poke through the rtcDyn database but can’t find anything to ID the user’s endpoints. As Lync has an open connection to the client while you’re logged-in, it mightn’t even capture the hostname or IP. :-(

      • Todd
        June 25th, 2014 at 17:26 | #8

        Has anyone determined how to map the clients to IPs? I have one client that is coming up with a BLANK VERSION and I can’t track it down

  3. Svein
    February 16th, 2012 at 08:55 | #9

    I get some errors.. Only lists connections on the server where I run the script..

    .\Get-CsConnections.ps1 -Pool lyncpool

    Checking these pool servers in pool: lyncpool.VUC.NO
    mslync01.vuc.no
    mslync02.vuc.no
    Exception calling “Open” with “0” argument(s): “A network-related or instance-s
    pecific error occurred while establishing a connection to SQL Server. The serve
    r was not found or was not accessible. Verify that the instance name is correct
    and that SQL Server is configured to allow remote connections. (provider: SQL
    Network Interfaces, error: 26 – Error Locating Server/Instance Specified)”
    At C:\Scripts\Get-CsConnections.ps1:181 char:18
    + $connection.Open <<<< ()
    + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

    Exception calling "Fill" with "1" argument(s): "A network-related or instance-s
    pecific error occurred while establishing a connection to SQL Server. The serve
    r was not found or was not accessible. Verify that the instance name is correct
    and that SQL Server is configured to allow remote connections. (provider: SQL
    Network Interfaces, error: 26 – Error Locating Server/Instance Specified)"
    At C:\Scripts\Get-CsConnections.ps1:190 char:31
    + $recordcount=$sqladapter.Fill <<<

    • Pat Richard
      April 19th, 2012 at 12:23 | #10

      Svein – I haven’t forgotten about this. I’ve seen this a couple of times, and not been able to determine the issue. Still looking…

      • Corey
        April 23rd, 2012 at 20:47 | #11

        I have this same error.

        • Pat Richard
          May 17th, 2012 at 08:27 | #12

          When you open your PowerShell/Lync Management Shell session, make sure you start it as Administrator. In a couple of instances where I’ve seen the error, doing that seems to help.

          • Corey
            May 17th, 2012 at 08:38 | #13

            That did not help when I was running it.

      • Tore
        July 3rd, 2012 at 08:11 | #14

        Hi! I got the same error on my pool where I have two FE servers. It will only list the users on the FE where I run the script. (and the result i 100 % connections)

  4. Russ
    April 11th, 2012 at 00:25 | #15

    I just want to say thanks for an awesome script. This gave me EXACTLY what a manager wanted to know.

    Cheers!

  5. Jeremy
    August 15th, 2012 at 12:23 | #16

    Hi Pat, not sure if this helps but I receive the same SQL Exception error, but only on one server. It works fine on my other Front-End in the same pool – I’m using the Powershell as Administrator and using the same login credentials on both servers.

    I don’t want to just post the negatives though! This script is fantastic and it’s helped me quite a bit thus far! Thanks very much.

    • Pat Richard
      August 16th, 2012 at 11:00 | #17

      Yeah, the problem is I’m not a SQL guy. I sometimes see this problem, and sometimes it goes away. Free beer to whoever figures it out!

  6. Mike
    August 27th, 2012 at 13:18 | #18

    I was gettign teh error mentioned above, so i changed the
    #Define SQL Connection String
    [string]$connstring = “server=$server\rtclocal;database=rtcdyn;trusted_connection=true;”
    to
    #Define SQL Connection String
    [string]$connstring = “server=\;database=rtcdyn;trusted_connection=true;”

    This got rid of that connection error, but now I get ‘Nothing returned from Query’. Perhaps that isn’t the right value to change if I want to hard code the SQL server? Any ideas on what would cause the ‘Nothing returned from Query’?

    • Mike
      August 27th, 2012 at 13:23 | #19

      For some reason, what i changed it to didn’t post correctly.

      lyncserver.domain.name\lync represent my SQL server & instance name

      #Define SQL Connection String
      [string]$connstring = “server=lyncserver.domain.name\lync;database=rtcdyn;trusted_connection=true;”

  7. Pat Richard
    August 27th, 2012 at 16:21 | #20

    For those having issues, look at the comment block near the top of the script. Make sure you follow those steps, including firewall exceptions, and named pipes.

  8. Pat Richard
    September 7th, 2012 at 09:49 | #21

    Bumped to v1.7 – sorting of server names is better; -ClientVersion no longer automatically triggers -IncludeUsers; minor code optimization. Also added some installation info to the blog post.

    Still not sure what’s causing some to not work. I’m not a SQL guy, but open to suggestions.

  9. Mark
    September 12th, 2012 at 17:08 | #22

    Pat, tremendous script – many thanks! Can I make a suggestion? Have the script output all connections and their version in a table? That would be easier than asking the script to tell me every connection with a specific version. Cheers!

    • Pat Richard
      September 12th, 2012 at 18:07 | #23

      Yeah, I’ve got some ideas around that as well as targeting just specific servers within a pool. It gets real interesting when there are 15,000 people in a pool and you want to see the users. :-)

      However, I’m working on some nagging issues that some people have reported. Hoping to get those squared away soon.

  10. Mark
    September 12th, 2012 at 18:16 | #24

    Oh, one other thing about the Installation: the because RTCLOCAL is a named instance, and assuming you’ll be connecting via TCP/IP, not named pipes (because TCP/IP normally has a higher priority when the connection type isn’t specified), the firewall needs to allow UDP 1434 (not TCP), the SQL Browser service needs to be running (I’m guessing that this is the most common connection problem) and the port that the instance is actually listening on (which can be seen in the SQL config) also needs to be open on the firewall – or just allow SQL Server. Named pipes isn’t then needed. However, if the client uses named pipes, not TCP/IP, the SQL instance does use the default named pipe, so in theory the SQL Browser shouldn’t be needed, just File and Printer sharing in the firewall. The former method doesn’t require changing the SQL server config, so I’d generally go for that.
    HTH

  11. Richard
    September 30th, 2012 at 07:55 | #25

    I just wanted to leave a short note to say thanks for creating this script, it is excellent!!

    It’s a good job there are people like you around to help the respective community in these cases where Microsoft fall short.

    Many thanks…

    R.

  12. Jacky Fan
    April 1st, 2013 at 06:04 | #26

    Hi,Pat

    Does the rtcdyn database containing the user information from which edge server it connect to ?

    If you get ideal the on which table in which column containing that information ,please share with me ,thanks

  13. Nate
    June 4th, 2013 at 16:13 | #27

    It would be awesome if this script had an option to get user information for all Pools in a domain. Then, if it had another option for how to organize that information either collectively or organized by pool, that would be amazing. Also, presumably, you should be able to get the version of Lync (2010 or 2013) and switch between differing SQL queries depending on version of the pool.

    • Pat Richard
      June 4th, 2013 at 17:07 | #28

      The problem with auto detecting the server version is that the WMI query takes at least 5 seconds. It’s really slow.

  14. July 25th, 2013 at 21:38 | #29

    Nice work Pat!

    • Pat Richard
      July 31st, 2013 at 09:42 | #30

      Thanks, John. And thanks for the testing with me the other day.

  15. Stanislaw
    September 16th, 2013 at 03:20 | #31

    Great script! Excellent! Thank you.

    I have one question according to this subject. Is there a possibility to get information about which user is doing what – I mean e.g. User1 is using Audio now, User2 is sharing his desktop etc.?

    • Pat Richard
      September 16th, 2013 at 08:58 | #32

      Not at this time. That would require extensive work.

  16. Jean-Luc
    September 17th, 2013 at 09:50 | #33

    Great script, thank you!
    I’m sorry but I don’t know “-clientversion” usage. I can’t use wildcard? I can’t see list of users who is using device/version.

    • Pat Richard
      September 25th, 2013 at 12:13 | #34

      You cannot use wildcards such as *. That’s a good request for a future version. You can feed it a shorter version number, such as 4.0.7577 to get everyone that has any version of that, including 4.0.7577.4398.

  17. Rob Hill
    October 9th, 2013 at 11:19 | #35

    Hi Pat, does this work for pool pairing where we have 2 STD servers in one site?

    • Pat Richard
      October 9th, 2013 at 11:22 | #36

      It queries the databases on the local machines in the pool. You can only specify one pool at a time, or one server at a time, or one user at a time. Within those confines, it should work. But I don’t have an environment in which to test that.

  18. JeffCSP
    October 10th, 2013 at 13:10 | #37

    Hi Richard, the last module for retrieving and displaying the assigned server order has a few bugs. 1) need to prefix sip: otherwise it is interpreted as the SamAccount. 2) Seems the selection of machineid and fqdn does not work for that property, at least it fails when running the command directly. Removing the select-object portion displays the FQDN of the machines. Appreciate all your efforts and sharing.
    Cheers,
    JeffCSP

  19. Matt
    October 21st, 2013 at 12:56 | #38

    Thank you for this script – it gives some great information that I have been looking to gather. Works well on Lync 2013 for me

  20. Juliano
    November 3rd, 2013 at 20:24 | #39

    Hi Pat Richard, I am starting to learn PowerShell. I would like to know if is possible to out the results to a file, but not the detailed information, just the informations that I see when I run the script and see the results on the screen. When I try to use the parameters -FilePatch I get the detailed results and when I use “| out-file -filepath [c:\example\example.txt] it throughs only the information, not the “headers” that shows when I see the output on the screen. Can you help me? Thanks

    • Pat Richard
      November 3rd, 2013 at 21:58 | #40

      The script does not output objects. It outputs text strings.

  21. Steve M
    November 5th, 2013 at 17:52 | #41

    Hi Pat

    Thanks for this script, it really is awesome.
    I’ve been running 2.2, 2.3 and 2.4 against Lync 2013 on Server 2012 and have been seeing this error. Results are returned, but i suspect some info is not. Do you have any ideas on a way to work around it?

    Method invocation failed because [System.Data.DataRow] doesn’t contain a method named ‘op_Addition’.
    At C:\Users\administrator\Get-CsConnections.ps1:413 char:4
    + $overallrecords = $overallrecords + $data
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (op_Addition:String) [], RuntimeException

    Steve

    • Pat Richard
      November 5th, 2013 at 17:54 | #42

      The most common issue I’ve seen is Windows firewall is blocking connections to the FEs.

      What switches are you using when calling the script?

  22. Marc
    November 7th, 2013 at 07:24 | #43

    Hi,

    It’s normal that’s not working with sba pool? Do I have to modify something?

    Thanks

    • Pat Richard
      November 7th, 2013 at 09:11 | #44

      I don’t have an SBA pool on which to test it.

  23. November 7th, 2013 at 15:54 | #45

    It works fine on my SBA, after I ran PowerShell as Administrator.

    • Marc
      November 8th, 2013 at 06:12 | #46

      Thanks for your answers, do you launch the powershell on the sba or on the FE? And you also use -pool for the sba?

      • Marc
        November 18th, 2013 at 12:06 | #47

        It’s working when I launch the script from the sba. Thanks

  24. Steve M
    November 7th, 2013 at 22:02 | #48

    Hi Pat,

    I am seeing that error in a number of environments, including my Dev lab where I have the Windows Firewall disabled. I was running the script on one of my FE’s using the -pool parameter only.

    The error implies an issue with one of your .net calls.

    Steve

  25. Tore
    November 20th, 2013 at 10:35 | #49

    Hi! I have three servers in the pool, but only get the users from one of the servers. I get this error: Method invocation failed because [System.Data.DataRow] doesn’t contain a
    method named ‘op_Addition’.
    At C:\sw\Get-CSConnections\Get-CsConnections.ps1:599 char:4
    + $overallrecords = $overallrecords + $data
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (op_Addition:String) [], Runti
    meException
    + FullyQualifiedErrorId : MethodNotFound

    Method invocation failed because [System.Data.DataRow] doesn’t contain a
    method named ‘op_Addition’.
    At C:\sw\Get-CSConnections\Get-CsConnections.ps1:599 char:4
    + $overallrecords = $overallrecords + $data
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (op_Addition:String) [], Runti
    meException
    + FullyQualifiedErrorId : MethodNotFound

    • Ben E
      March 19th, 2014 at 23:26 | #50

      Had a similar error:
      Method invocation failed because [System.Data.DataRow] does not contain a method named ‘op_Addition’.
      At C:\admin\scripts\Get-CsConnections.v2.6\Get-CsConnections.ps1:590 char:4
      + $OverallRecords = $OverallRecords + $data
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo : InvalidOperation: (op_Addition:String) [], RuntimeException
      + FullyQualifiedErrorId : MethodNotFound

      Caused when i had a Lync Basic client running on a Win2012r2 server. Once i logged out it went away.

  26. Pat Richard
    March 19th, 2014 at 14:04 | #51

    FYI: Client Agents that start with “LMR/”, as in “LMR/15.0.4569.1006″ are Lync Room Systems.

  27. April 14th, 2014 at 15:10 | #52

    Just wanted to post and say thanks for this script, the -incudeusers function is used by me a lot, thanks!

  28. Andy Cheetham
    May 9th, 2014 at 03:26 | #53

    Pat – Great Utility. Really useful for us to quickly view how our new deployemtn of Lync 2013 is being used. Keep up the great work!

    Andy Cheetham
    IT Manager
    Morgan Advanced Materials

  29. Andy
    May 14th, 2014 at 13:24 | #54

    This would be great if you encompassed the whole thing in it’s own function so that I can put the ps1 on a network share then have my PS profile load the function for use upon opening powershell rather than having to distribute the file and running the physical file everytime i want to use it.

    • Pat Richard
      June 23rd, 2014 at 22:57 | #55

      Put it in a folder on a network share and add the share path to your computer path.

  30. Michael
    June 23rd, 2014 at 22:45 | #56

    This script has been a real help – thanks so much.

  31. kanishka
    July 15th, 2014 at 23:39 | #57

    Hi,

    Is it possible to run this script and get users connections specific only to a particular OU ?

    Thanks,
    Kanishka.

    • Pat Richard
      July 16th, 2014 at 09:26 | #58

      Not at this time.

      • Chamila
        July 29th, 2014 at 07:59 | #59

        Is it doable? and also please let me know whether this is editable to get category wise, means how many video calls, audio calls etc..

        • Pat Richard
          July 29th, 2014 at 08:18 | #60

          As I mentioned above, this script does not support that. If you want reporting, look at something like Event Zero’s Dossier product.

  32. Thierry
    July 16th, 2014 at 07:48 | #61

    line 300 of version 2.8 is not PowerShell 2 friendly:
    if (Get-Module -ListAvailable | Where-Object Name -eq “$name”) {

    I’m still learning about PowerShell so i do not have a suggestion to replace yet…
    … but if I had to guess it would look something like that:
    if (Get-Module -ListAvailable | Where-Object { $_.Name -eq “$name”}) | Select-Object {

    • Pat Richard
      July 16th, 2014 at 09:23 | #62

      Change your copy to
      if (Get-Module -ListAvailable | Where-Object {$_.Name -eq “$name”}) {
      and tell me if it works.

  33. August 12th, 2014 at 05:28 | #63

    Hello Pat,

    Great script you have here. What I would like to see per user connection what version is being used. This way we can see if the user software is upgraded from like lync 2010 to Lync 2013.

    With regards,

    Jelle

    • Pat Richard
      August 12th, 2014 at 09:54 | #64

      You can already see that with the -clientversion option.

      • August 12th, 2014 at 10:10 | #65

        Great to hear, I have tested this and it works fine, also when searching for client version like Lync 2013 you can specify -ClientVersion OC/15 and it will popup all lync 2013 clients that are connected. Great script

  34. Red
    September 24th, 2014 at 03:40 | #66

    Hi,
    without the parameter -Is2013 it does return anything. ;-)

    Red.

    • Pat Richard
      September 24th, 2014 at 10:14 | #67

      Are you targeting a pool or a specific server?

  35. Mike
    October 28th, 2014 at 15:10 | #68

    This script is great and very helpful but I am now getting the error below when I try to run it:

    PS C:\> .\Get-CsConnections.ps1
    .\Get-CsConnections.ps1 : File C:\Get-CsConnections.ps1 cannot be loaded. A required certificate is not within its validity period when
    verifying against the current system clock or the timestamp in the signed file.
    At line:1 char:1
    + .\Get-CsConnections.ps1
    + ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

    I downloaded the latest version of the script. Our execution policy is set to remote signed. I get the same error on all 3 front-end servers.

    • Pat Richard
      October 28th, 2014 at 16:26 | #69

      I released a new version today with an updated cert. Download it and give it a whirl. Thanks for reporting the issue.

  36. Mahmoud Badran
    October 29th, 2014 at 12:08 | #70

    Thanks for the recognition

  37. Amr Morsy
    October 29th, 2014 at 15:01 | #71

    Thank you, Wonderful Script, working fine, but can it help providing the IP Addresses for each device (Client) if possible

    • Pat Richard
      November 5th, 2014 at 13:09 | #72

      Not at this time.

      • Alan
        December 22nd, 2014 at 16:54 | #73

        Hello,
        This is a feature that I’m very interested in as well.
        I can see that I’m logged in from 4 different locations, but I cannot figure out where they are!

        One is my workstation, the other is my phone. I have no idea where the others are from and it’s driving me nuts.

  38. jones1337
    November 25th, 2014 at 04:02 | #74

    This script is amazing! Would it be possible to add to see which client version a particular user connection is using?

    • Pat Richard
      November 25th, 2014 at 06:30 | #75

      That’s already in there.

  39. Cormac
    January 7th, 2015 at 12:21 | #76

    Thanks so much for this :) looking forward to future updates

  40. January 29th, 2015 at 05:59 | #77

    Hello Pat,

    Good job on the script and the whole post for installation,
    I have a question related to the connections – is it possible somehow to drop those for specific sipaddress/lync user ?

    We have stumbled upon a strange issue which involves both mobile clients and integration with Exchange/IM OWA access.
    Basically what happens with the client connections is that if you don’t sign off properly, for example terminate the application on the mobile device or close down the browser without signing off, the presence of this user shows as available when looking up him from the address book, though when you try to message him this generic error pops up:
    reference error ID 450 (source ID 239) a message was not delivered and got this error.
    This by the way raises as well issues with response groups when the calls are being routed to so called “available users”…

    Any ideas, maybe someone had a chance to notice this as well?

    • Pat Richard
      January 29th, 2015 at 12:53 | #78

      No plans for further filtering of users at this time.

  41. Anitaa
    February 5th, 2015 at 09:08 | #79

    Hello, There is a problem with the script. In my environment, I have 3 servers and one of them is in drain mode. Obviously there is no active conference and call hosted on this, (I have checked with the get-cswindowservice). However, when I run the script, i see on this drain-mode enabled server are connections and clients connected :). Can you fix it?

    • Pat Richard
      February 5th, 2015 at 09:42 | #80

      There is nothing wrong with the script. It shows users registered against FEs. NOT CONFERENCES. Get-CsWindowsService doesn’t show the number of registered connections.

      • Anitaa
        February 11th, 2015 at 16:00 | #81

        I didnt explain it well… So i have server A in drain mode, and server B and C – these 2 are operational. On the server A that obviously has no connection at all with any client, I run the script and i see x% connections, on the other two servers the same x% connection, but every-time is written the server name on that i am running the script. What I dont understand how is possible to have any connections or clients connected to , when the server is in drain mode?

        • February 11th, 2015 at 16:03 | #82

          If a server is draining, then there are still clients connected to it. Draining attempts to have those clients move to another FE. But as long as services are still draining, there’s likely still connections. New connections are denied, but existing ones, especially those in conferences, can continue for minutes, even hours.

  1. November 19th, 2011 at 15:42 | #1
  2. January 18th, 2012 at 04:13 | #2
  3. March 17th, 2013 at 12:03 | #3
  4. May 13th, 2013 at 20:33 | #4
  5. June 30th, 2013 at 02:12 | #5
  6. May 1st, 2014 at 23:14 | #6
  7. June 10th, 2014 at 09:33 | #7
  8. October 28th, 2014 at 18:08 | #8
  9. December 8th, 2014 at 18:02 | #9