Report showing individual message count per user in Skype for Business

Kevin Staley
Kevin Staley used Ask the Experts™
on
Our company uses O365 for all employees. One app we use within it is Skype for Business. We would like to get a report showing how many individual messages a given user sends from Skype. The MS reports only seem to provide session counts. I know in the conversation history you can see the messages sent/received, but to manually scroll through Inboxes and count these is not practical. Are there any PS scripts for this?

Thanks for the assistance in advance!
Kevin
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
Try the Get-CsUserSession cmdlet, it will spill all the details you need. You can look for "[IM]" values in the MediaTypesDescription property to filter just messages.
Kevin StaleyMIS Administrator

Author

Commented:
Thanks for the help!

In looking up where and how to run that cmdlet, I discovered I needed to download and install the "Skype for Business Online, Windows PowerShell Module," and two other installs (Visual C++ 2017 14.10.25008.0 and Win7AndW2K8R2-KB3191566-x64).

However, now that I have those in place, I tried to run the cmdlet and get an error stating, "Get-CsUserSession : The term 'Get-CsUserSession' is not recognized as the name of a cmdlet." I have tried using Windows Powershell and enter,
"Import-Module "C:\\Program Files\\Common Files\\Skype for Business Online\\Modules\\SkypeOnlineConnector\\SkypeOnlineConnector.psd1",

then I entered, "New-CsOnlineSession -UserName myusername@mycompany.onmicrosoft.com". I am prompted to enter my password and also a verification code (I'm using multi-factor authentication), which once entered, displays the session id and a few other session related bits of information. It is at the subsequent Windows PS prompt that I enter the cmdlet and get the error.

I am trying to do this using a Windows 7 64-bit SP1 PC.

Thanks again for the assistance!
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
You need to be a SfBO admin or Global admin in order to run the cmdlet.
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

Kevin StaleyMIS Administrator

Author

Commented:
I am using an account that has those privileges.
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
Try a different account then? Here's how a sample output should look like:

# Get-CsUserSession -User vasil@michev.info -StartTime "01 Jan 2018" | ? {$_.MediaTypesDescription -match "\[IM\]"} |select -First 1

StartTime             : 06/11/2018 09:55:25
EndTime               : 06/11/2018 10:39:48
FromUri               : vasil@michev.info
ToUri                 : mhaque@microsoft.com
FromClientVersion     : RTCC/7.0.0.0 UCWA/7.0.0.0 AndroidLync/6.22.0.30 (WAS-LX1 Android 8.0.0)
ToClientVersion       : RTCC/5.0.0.0 IMMCU/7.0.2229.0
ToEndpointId          :
FromEndpointId        : 8D10E0E8-AB95-5109-BCE2-87E4D413FD13
ConferenceUrl         : sip:mhaque@microsoft.com;gruu;opaque=app:conf:focus:id:w9bm3ycv
ResponseCode          : 200
MediaTypesDescription : [Conference][IM]
ErrorReports          : {{"RequestType":"MESSAGE","RequestTime":"2018-11-06T10:17:22.908","ContentType":"text/plain","ResponseCode":"200","DiagnosticId":24125,"ErrorCategory":"ExpectedFailure","Diagn
                        osticHeader":"24125;Component=\"RTCC/7.0.0.0_UCWA/7.0.0.0 AndroidLync/6.22.0.30 (WAS-LX1 Android 8.0.0)\";Reason=\"IM delivery was

Open in new window

Kevin StaleyMIS Administrator

Author

Commented:
Tried two accounts known to hold the permissions you described. Might be the Powershell I'm using. It's Windows PS 5.1. Thanks. I'll keep trying other methods.
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
Well, I totally forgot that they added this to the SfBO Admin portal (too used to Microsoft Teams nowadays). So try this: Office 365 Admin Center -> Admin Portals -> Teams and SfBO -> Open legacy portal -> Reports -> Session details.
Kevin StaleyMIS Administrator

Author

Commented:
Thanks. That looked very promising, but when I selected users who showed a fair number of a SfBO sessions in the Reports-> Usage -> Skype for Business Activity report, it returned "no data."
Kevin StaleyMIS Administrator

Author

Commented:
Should have also said I selected a from date of about 60 days ago, so there should have been a lot of data for this user. I also tried several other users who show a higher level of SfBO activity.
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
Seems to work fine for me, but it's not uncommon for reports in O365 to be missing some data. You can always open a support case to get this investigated.
Kevin StaleyMIS Administrator

Author

Commented:
So, I just got this working in PowerShell. I used the "Windows Powershell ISE" launched as administrator. I ran this script to connect:
Set-ExecutionPolicy unrestricted
Import-Module SkypeOnlineConnector
$session = New-CsOnlineSession -UserName xxxxxx@xxxxxxx.com (replace x's with your username and tenant domain)
Import-PSSession -Session $session

I ran the cmdlet you mentioned on my own O365 account. I see the Skype activity listed. Now, what would really be helpful is to tally the total number of IM messages (not sessions) from a given start date. Is there a way to do that?
Most Valuable Expert 2015
Distinguished Expert 2018
Commented:
Just save them all to a variable, then Group them by MediaTypesDescription. Something like this:

$list = Get-CsUserSession -User user@domain.com -StartTime "01 Jan 2018" | ? {$_.MediaTypesDescription -match "\[IM\]"}
$list | group MediaTypesDescription

Open in new window


or just filter them out

Get-CsUserSession -User user@domain.com -StartTime "01 Jan 2018" | ? {$_.MediaTypesDescription -match "\[IM\]"}  |measure

Open in new window

Kevin StaleyMIS Administrator

Author

Commented:
Thanks so much for your assistance!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial