Script: List the last time a User registered on a Lync pool and its client type

Update #2: 5-July-2014 We’ve added some new functionally to the script:

  1. Check if the User is running under Administrator elevation privileges
  2. The Information also includes results from the Get-CsUserPoolInfo cmdlet, meaning that you can now see when the user last logged in, and also see what his primary main server is and what his backup servers are.
  3. Added additional validation tests

Download the new version  Here


Update: 8-May-2014 – with the help of @y0av, we’ve updated the script to version 0.41 to include more options for display and export. Download it Here


Recently I’ve been asked to pull out a list of all users connected to Lync, their Last Logon date and the type of client they were using.

There were already a lot of articles around this subject, but I couldn’t find anything which output both Client last logon and the type of client it was logged on with.

Based on the following great articles which go into details with what are the required SQL queries and how to combine it into a PowerShell script, I’ve created a SQL Query command and a dedicated PowerShell script which will provide with the desired output.

The SQL Query:

Please note that the SQL Query is based on the Lync RTCDYN database which does not hold details for a long period of time like the Lync LCSCDR database.
The reason for that is that I wasn’t able to get the Client Type out of the LCSCDR database.

The SQL Relationships of the RTCDYN table:


The PowerShell Script:

Download HERE

Output for Example:



  1. Pingback: NeWay Technologies – Weekly Newsletter #93 – May 1, 2014 | NeWay

  2. Pingback: NeWay Technologies – Weekly Newsletter #93 – May 2, 2014 | NeWay

  3. Pingback: Script Update: List the last time a User registered on a Lync pool and its client type | Just a Lync Guy

  4. Sebastian

    Hello Sr, what i need to choose when say “Please choose the Registrar you want to query (1-1)” ?

    Thank you very much

    1. Guy Bachar (Post author)

      Just choose ‘1’ 🙂


Leave a Comment

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.