Teams Real Simple with Pictures: Enabling Media Logging with PowerShell

Written: 24/07/2022 | Updated: N/A

If we have an issue with Teams and we raise a ticket to Microsoft, then occasionally we will be asked to provide logs for engineers to analyse. With Teams, there are several different ones. These include Debug logs, Media logs and Desktop Logs. This week, I noticed that it is now possible to enable Media Logging with PowerShell. Up until this point the user would have to enable it within the Teams client, and this would be problematic for IT in terms of being dependent on users and if it would be enabled at the required time. The Media Logs, by definition, contain diagnostic data about audio, video, and screen sharing. They are linked to call-related issues. Having a problem with resolution? Or an encoder? Or rendering? Or a situation where share control is given in a meeting but cannot be taken back? The Media logs may provide insights to fix the issue. Yet Media Logging is only enabled by default on machines using the Teams client with specific CPU’s: any Apple M1, any Intel Xeon, any Intel i9, except for the U, G7, M, and MQ series and any 6th generation and later Intel i7, except for the U, G7, M, and MQ series. So, in many cases it has to be enabled. Being able to do it with PowerShell saves time – for both the user and the admin

Let’s go

This blog will cover

  • Enabling Media Logging in the Teams Client
  • Enabling Media Logging via PowerShell
  • Getting the Media Logs
  • FAQ

NOTE: This functionality is rolling out – and whilst this was tested on a Ring 4 tenant it may only work in Teams clients switched to public preview until the rollout completes

Pre-requisites

  • Teams Administrator or Global Administrator permissions (for PowerShell)

ENABLING MEDIA LOGGING IN THE TEAMS CLIENT
The way to enable Media Logging within the Microsoft Teams Client is as follows

1.) In Microsoft Teams, select More Options (…) next to the Avatar and then Settings

2.) In the General menu, tick Enable logging for meeting diagnostics (requires restarting Teams)

3.) To complete, Right Click on the Teams Icon on the Task Bar and select Quit. Then start Teams again

4.) If you return to the settings, Media Logging is now enabled

5.) Whilst this is a straightforward process the user may be difficult to get a hold of; or may not consider it a priority. It could also take the administrator significant time if it were multiple users who were all based remotely. In addition, user-based Media logging turns itself off should the user sign out which could mean the data required isn’t captured

ENABLING MEDIA LOGGING VIA POWERSHELL
Now let’s enable Media Logging for a user via PowerShell

1.) Search for PowerShell and select Run as Administrator

2.) Use the following to install the Microsoft Teams Module

Install-Module -Name MicrosoftTeams -Force -AllowClobber

3.) Use the following to initialize a session. You may need to authenticate so have your admin credentials to hand

Connect-MicrosoftTeams

4.) To see if the functionality exists in your tenant run the following command which will display the Media Logging Policies currently applied to your organization. It should be Disabled by default

Get-CsTeamsMediaLoggingPolicy

5.) There are two available options. The global policy here could be amended so Media Logging is enabled for all users. Or the second option is that the policy could be applied to specific users. Now, with the Media Logging cmdlets, New-CsTeamsMediaLoggingPolicy doesn’t exist? So how do we apply it to a user? In this case use the following to enable on a user

Grant-CsTeamsMediaLoggingPolicy -Identity [UPN] -PolicyName Enabled

6.) Check this has applied by running the command below. As shown, the TeamsMediaLoggingPolicy is applied directly to the user and is enabled

Get-CsUserPolicyAssignment -Identity [UPN]

7.) Going back into the setting in the Teams Client Media Logging is enabled

8) Adding a policy to the user overrides the client settings, so even if a user unchecked the box in the settings and signed out, the box would be ticked the next time they logged in. So application of a policy to the user is good from an administrative perspective that all the required data can be captured

GETTING THE MEDIA LOGS
There are two places to find the Media Logs

1.) In Search type in %appdata%\Microsoft\Teams\media-stack

2.) Get the following files. If you have multiple copies of the log files you can either submit both or take the latest one/the one with data in

Log file nameDescription
Teams.msrtc-0-s1039525249.blogContains information related to the media stack. This includes channel status such as resolution, decoders and encoders used, and the number of frames sent and received, and camera and video-based screen sharing (VBSS) session status.
rtmcontrol.msrtc-0-2415069487.blogRecords information related to remote control actions, such as the time stamp when control is given, and mouse pointer information.
Teams_MediaStackETW-2-U-xr-U.etlRecords media stack trace events.

2.) Once you have the files, In Search type in %appdata%\Microsoft\Teams\skylib

2.) Get the following files. If you have multiple copies of the log files you can either submit all the copies or take the latest one/the one with data in

Log file nameDescription
Debug-0-s2790420889.blogContains information related to the media agent, including rendering quality.
tscalling-0-2061129496.blogRecords events in the ts-calling API.

You can send the Media logs off to Microsoft. In terms of how best to get the logs, you can provide instructions to users, do a Microsoft Teams meeting and guide, or use a remote connection app such as Quick Assist to extract the logs

FAQ

Q. How do I remove a Media Logging Policy from an Individual?

Grant-CsTeamsMediaLoggingPolicy -Identity [UPN] -PolicyName $Null

Q. I want to enable Media Logging on all my users. How do I do that?
A. It’s not recommended since Microsoft recommend only high performing machines to run it, however, this will enable everyone

Grant-CsTeamsMediaLoggingPolicy -Global -PolicyName Enabled

Q. Can I apply it to a group?
A. No. Upon testing it on both a Microsoft 365 and Security Group it does not currently support groups

Q. Will it come into the TAC one day?
A. Policies often end up in the TAC, and I wouldn’t be surprised if this surfaces one day. Microsoft are still working on introducing policies in the TAC after surfacing them in PowerShell – Call Hold Policy is the latest example of that

2 thoughts on “Teams Real Simple with Pictures: Enabling Media Logging with PowerShell

Comments are closed.