Displaying Logged in Users and their Devices using CUCM Shell

We all know in CUCM we can find logged in Users by clicking on the Device Tab then selecting the  Active Logged in Users dropdown on the top right of the window. This displays a list of currently logged in users and what device they have logged onto. To do this in the shell so we can export to a text or CSV file run the following command

run sql select d.name, eu.userid, p.name from extensionmobilitydynamic emd, device d, device p, enduser eu where emd.fkdevice=d.pkid and emd.fkdevice_currentloginprofile=p.pkid and emd.fkenduser=eu.pkid

This will output currently logged on profiles and their relating device. If we just wanted show output for a particular user, for example John Doe, with userid jdoe. We would run the following.

run sql select d.name, eu.userid, p.name from extensionmobilitydynamic emd, device d, device p, enduser eu where emd.fkdevice=d.pkid and emd.fkdevice_currentloginprofile=p.pkid and emd.fkenduser=eu.pkid and eu.userid=jdoe

This will show the following columns: Device Name, User ID, UDP Profile Name

If you would like to add in the DN, simply include the relevant dnorpattern fields.

Let’s take this a step further. Let’s say we are migrating to a new CUCM Cluster and we need to login users to the phones they were logged into on the existing CUCM Cluster.

Once we have this output, we can convert to CSV via the Import Data functionality in Excel, I use space as a separator, then bring together the UDP Profile name with a simply Excel formula. Now we merge the data into the EM Login URL. The URL is below

http://IP.ADDRESS:8080/emapp/EMAppServlet?device=#DEVICE#&&userid=USERID&seq=PIN

Simply reference the EM login URLs with a scripting language of your choice and run against the new CUCM Cluster. Users will be auto logged into their phone

This entry was posted in Cisco UC and tagged by ben. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>