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 128x128Looks like I now have the correct firewall configuration for connecting to SQL. It’s listed below in the installation section.

Tracy 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.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 20, 2012 at 3:11 pm | #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 21, 2012 at 8:02 am | #2

      That’s on the wish list for that script.

      • June 15, 2013 at 8:25 am | #3

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

        • Pat Richard
          June 15, 2013 at 10:22 am | #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.

  2. John
    February 15, 2012 at 12:55 am | #5

    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 18, 2012 at 5:24 am | #6

      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. :-(

  3. Svein
    February 16, 2012 at 8:55 am | #7

    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 19, 2012 at 12:23 pm | #8

      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 23, 2012 at 8:47 pm | #9

        I have this same error.

        • Pat Richard
          May 17, 2012 at 8:27 am | #10

          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 17, 2012 at 8:38 am | #11

            That did not help when I was running it.

      • Tore
        July 3, 2012 at 8:11 am | #12

        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 11, 2012 at 12:25 am | #13

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

    Cheers!

  5. Jeremy
    August 15, 2012 at 12:23 pm | #14

    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 16, 2012 at 11:00 am | #15

      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 27, 2012 at 1:18 pm | #16

    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 27, 2012 at 1:23 pm | #17

      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 27, 2012 at 4:21 pm | #18

    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 7, 2012 at 9:49 am | #19

    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 12, 2012 at 5:08 pm | #20

    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 12, 2012 at 6:07 pm | #21

      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 12, 2012 at 6:16 pm | #22

    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 30, 2012 at 7:55 am | #23

    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. John
    November 9, 2012 at 1:46 pm | #24

    I got an error when using -sipaddr: “Cannot find user in Active Directory with the following SAM account Name…” until I changed line 584 to :
    $UserPreferredInfo = Get-CsUserPoolInfo -Identity sip:$SipAddress

    • Pat Richard
      November 25, 2013 at 12:58 pm | #25

      This is slated for inclusion in v2.5. Thanks!

  13. John
    February 3, 2013 at 9:37 pm | #26

    Is the script working for Lync 2013?

  14. Darin
    February 5, 2013 at 5:30 pm | #27

    Anyone using this successfully with Lync Server 2013? I get nothing returned when trying a 2013 pool or a 2013 server.

    • Pat Richard
      February 7, 2013 at 4:42 pm | #28

      I don’t think it’s going to work on 2013. The database layout is different.

  15. Brian
    March 5, 2013 at 5:45 pm | #29

    I modified lines 256-262 as follows to get the script to work with 2013:

    $command.CommandText = “Select (cast (RE.ClientApp as varchar (100))) as ClientVersion, R.UserAtHost as UserName, RA.Fqdn `
    From rtcdyn.dbo.RegistrarEndpoint RE `
    Inner Join rtcdyn.dbo.Endpoint EP on RE.EndpointId = EP.EndpointId `
    Inner Join rtc.dbo.Resource R on R.ResourceId = RE.OwnerId `
    Inner Join rtcdyn.dbo.Registrar RA on EP.RegistrarId = RA.RegistrarId `
    $whereClause `
    Order By ClientVersion, UserName”

  16. Jacky Fan
    April 1, 2013 at 6:04 am | #30

    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

  17. Louise Aalto
    May 1, 2013 at 3:55 pm | #31

    I am using a version of this script on Lync 2013 pool and putting the results into a csv but it only give users from one of the servers in the front end pool and returns no results from the other

    • Pat Richard
      May 1, 2013 at 3:56 pm | #32

      This script isn’t meant for 2013. If you just do the console output, does it show connections for all pool servers?

      • Louise Aalto
        May 2, 2013 at 10:39 am | #33

        Pat, that’s the interesting thing, I have 2 servers in my lync 2013 front end. It reports the # of users in the 2nd server spw099lnc04 but not in spw099lnc03 the first server….they were built the same time/way. See results. I have run the script from both front ends with the same result. See below. PS. 2013 control panel doesn’t tell you # of users on a server within the front end pool.

        PS C:\tempscripts> .\Get-csconnections.ps1 -filepath C:\tempscripts\lync20130
        2.csv

        cmdlet Get-CsConnections.ps1 at command pipeline position 1
        Supply values for the following parameters:
        (Type !? for Help.)
        Pool: lyncfe2013

        Checking these pool servers in pool: lyncfe2013.COMPUCOM.LOCAL
        spw099lnc03.compucom.local
        spw099lnc04.compucom.local
        Iterate through Frontend pool collection
        Working on server spw099lnc03.compucom.local
        Query database ‘rtcdyn’ at ‘spw099lnc03.compucom.local\rtclocal’
        No data returned!!
        Working on server spw099lnc04.compucom.local
        Query database ‘rtcdyn’ at ‘spw099lnc04.compucom.local\rtclocal’
        $data length 51

        Query Results written to C:\tempscripts\lync20130502.csv

  18. Darin
    May 1, 2013 at 4:12 pm | #34

    Forgot to come back after I ran into similar issues in February. Since then I’ve been querying a Lync 2013 pool with minor modifications to the SQL in function Get-Data. I only use this with -Pool and -FilePath, so it’s possible that some other options do not work correctly.

    Starting at line 256, replace with:
    $command.CommandText = “Select (cast (RE.ClientApp as varchar (100))) as ClientVersion, R.UserAtHost as UserName, Reg.Fqdn `
    From rtcdyn.dbo.RegistrarEndpoint RE `
    Inner Join rtcdyn.dbo.Endpoint EP on RE.EndpointId = EP.EndpointId `
    Inner Join rtc.dbo.Resource R on R.ResourceId = RE.OwnerId `
    Inner Join rtcdyn.dbo.Registrar Reg on EP.RegistrarId = Reg.RegistrarId `
    $whereClause `
    Order By ClientVersion, UserName”

    This changes the last field in the select list and the last join. Use at your own risk of course.

  19. Bill
    May 8, 2013 at 1:03 pm | #35

    Darin,
    Thanks for the fix. Works awesome with Lync 2013

  20. June 3, 2013 at 5:52 am | #36

    Just a quick note to say thanks! This is exactly what we were looking for and has saved someone on our team a ton of work. Cheers :-)

  21. Nate
    June 4, 2013 at 4:13 pm | #37

    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 4, 2013 at 5:07 pm | #38

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

  22. Nate
    June 4, 2013 at 4:24 pm | #39

    Found a bug: When more than one pool in a domain, and including the “-ShowTotal” switch, totals for the entire domain are shown, not just totals for the pool specified. Example:
    Total Unique Users/Clients Total
    ——————————————————–
    Unique Users Connected 504
    Lync Enabled Users 16811 – incorrect
    Voice Enabled Users 101 – incorrect
    Percentage of Enabled Users Connected 3.00 %
    Client Versions Connected 14
    ——————————————————–

    • Pat Richard
      June 4, 2013 at 5:06 pm | #40

      That is by design – mainly because I didn’t think about it. :-)

      I’ll DCR it and see if I can get that changed. Thanks for letting me know.

  23. Mike van Stijn
    July 23, 2013 at 1:07 pm | #41

    Hello Pat

    this is one of the best Tools that exist for a Lync Admin. We found one Bug if the Script is installed into a Global Path so that it can be called from everywhere your cleanup routine produces errors because the path to the script is wrong. Then you get errors like:

    Get-Content : Cannot find path ‘C:\Users\Svc-lync-install\Get-CsConnections.ps1′ because it does not exist.
    At C:\Windows\system32\Get-CsConnections.ps1:333 char:12
    + $result = Get-Content $path |
    + ~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (C:\Users\Svc-ly…Connections.ps1:String) [Get-Content], ItemNotFoundExceptio
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand

    After we analysed the Script we found at the end of the script the Call:

    Remove-ScriptVariables($MyInvocation.MyCommand.Name)

    As $MyInvocation.MyCommand.Name only Returns Get-CsConnections.ps1 and Get-Content then searches in the local directory of the user the call should better be:

    Remove-ScriptVariables($MyInvocation.MyCommand.Definition)

    This returns the full path including the filename and avoids this way the error when the script is in another path then the user currently is in the shell.

    • Mike van Stijn
      July 23, 2013 at 1:17 pm | #42

      Oh and i forgot in the previous post a simple way to detect the server version

      (get-csservice -poolfqdn $Pool -registrar).version

      This returns a 4 for an OCS a 5 for a Lync 2010 and a 6 for Lync 2013

      • Pat Richard
        July 25, 2013 at 8:56 pm | #43

        Yeah, this is already staged in my new version. Previous methods I’ve tried took too long to execute, but this one has seemed pretty solid.

        Thanks!

    • Pat Richard
      July 25, 2013 at 8:55 pm | #44

      Thanks for reminding me. I’ve updated the function I use in newer scripts, but didn’t go back and update this one. I’ll get it updated and pushed out. Probably in the next few days.

  24. July 25, 2013 at 9:38 pm | #45

    Nice work Pat!

    • Pat Richard
      July 31, 2013 at 9:42 am | #46

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

  25. Stanislaw
    September 16, 2013 at 3:20 am | #47

    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 16, 2013 at 8:58 am | #48

      Not at this time. That would require extensive work.

  26. Jean-Luc
    September 17, 2013 at 9:50 am | #49

    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 25, 2013 at 12:13 pm | #50

      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.

  27. Jean-Luc
    September 26, 2013 at 3:43 pm | #51

    I’ve made a small modification for case insensitive client version on line 253:
    [string]$whereClause = “where upper(RE.ClientApp) like upper(‘%$ClientVersion%’) and R.UserAtHost not like ‘RtcApplication-%’ ”

    Sample query:
    Get-CsConnections.ps1 -ClientVersion oc
    => returns Lync Windows Clients
    Get-CsConnections.ps1 -ClientVersion ipad
    => returns Lync iPad Clients

    Thank you Pat

  28. Pat Richard
    September 27, 2013 at 3:02 pm | #52

    Thanks for the info, Jean-Luc. I’ll incorporate the case insensitivity change in the next release.

  29. Rob Hill
    October 9, 2013 at 11:19 am | #53

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

    • Pat Richard
      October 9, 2013 at 11:22 am | #54

      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.

  30. JeffCSP
    October 10, 2013 at 1:10 pm | #55

    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

  31. Matt
    October 21, 2013 at 12:56 pm | #56

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

  32. Juliano
    November 3, 2013 at 8:24 pm | #57

    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 3, 2013 at 9:58 pm | #58

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

  33. Steve M
    November 5, 2013 at 5:52 pm | #59

    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 5, 2013 at 5:54 pm | #60

      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?

    • Bryan
      January 27, 2014 at 5:24 am | #61

      Declaring $overalldata and $data as @() before they get used will fix this. The problem is caused if the SQL call only returns one row – which doesn’t support having more data added to it. If you define the variable as an array first, then it doesn’t matter if that happens.

      • Pat Richard
        March 20, 2014 at 12:36 am | #62

        This is resolved in 2.7, which should be released soon. Thanks for the info!

  34. Marc
    November 7, 2013 at 7:24 am | #63

    Hi,

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

    Thanks

    • Pat Richard
      November 7, 2013 at 9:11 am | #64

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

  35. November 7, 2013 at 3:54 pm | #65

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

    • Marc
      November 8, 2013 at 6:12 am | #66

      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 18, 2013 at 12:06 pm | #67

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

  36. Steve M
    November 7, 2013 at 10:02 pm | #68

    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

  37. Tore
    November 20, 2013 at 10:35 am | #69

    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

  38. November 26, 2013 at 12:05 pm | #70

    Hi Pat,

    This is my most used script, especially during rollout to track progress. Great work.

    FYI, If you have more than one entry in Get-CSRegistrarConfiguration it causes an error on line 525 as it can’t compare “4″ to “8 8 8″ (if you have three like me).

    I usually fix by making it look at the Global identity.

    Cheers…

    Matt

    • Pat Richard
      November 26, 2013 at 12:50 pm | #71

      This will be fixed in v2.6. Thanks for the info.

  39. Matt
    December 11, 2013 at 11:51 am | #72

    I get this error.. I was wondering if someone could help?

    MaxEndPointsPerUser is . Please specify a number for UserHightConnectionFlag that does not exceed this. You Specified 4.

    Is the script having trouble reading CsRegistrarConfiguration ?

    • Pat Richard
      December 11, 2013 at 11:55 am | #73

      If you do a Get-CsRegistrarConfiguration, does it return info? Is there only one config?

    • Matt
      December 11, 2013 at 11:56 am | #74

      Ha! I answer my own question looking at Matt Ellis’ post above.

      • Pat Richard
        December 11, 2013 at 11:57 am | #75

        What version are you using? This should have been resolved in the latest version.

  40. March 18, 2014 at 11:30 pm | #76

    Was getting an error:

    Method invocation failed because [System.Data.DataRow] doesn’t contain a method named ‘op_Addition’

    Had to modify the script to initialize the $overallrecords variable as an array:

    $OverallRecords = @()

  41. Pat Richard
    March 19, 2014 at 2:04 pm | #77

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

  42. April 14, 2014 at 3:10 pm | #78

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

  1. November 19, 2011 at 3:42 pm | #1
  2. January 18, 2012 at 4:13 am | #2
  3. March 17, 2013 at 12:03 pm | #3
  4. May 13, 2013 at 8:33 pm | #4
  5. June 30, 2013 at 2:12 am | #5

Leave a Reply