Configure Microsoft Teams application settings using PowerShell and Proactive Remediations in Microsoft Endpoint Manager

Introduction

Almost a year ago, I wrote a blog post on how to configure Microsoft Teams application settings using Configuration Manager and Powershell. For good measures, find this post in the link below:

Not too long ago, I started getting some reports on, that Teams is no longer picking up the changes made to the config.json and that Teams is hanging at the loading screen. I initially tried to reproduce, but was unable to.

I decided to invest some more time into the issue, and ended up being able to reproduce and find the cause. In the process of troubleshooting, I decided to try and move this into Proactive Remediations in Microsoft Endpoint Manager as well. The result made up this blog post.

Below a quick illustration of running the solution manually. The detection script detects that Microsoft Teams needs its settings configured, and the configure script carries out the configuration.

PowerShell

Most of the nifty details on how Microsoft Teams stores its settings in a config.json file, is explained in details in my previous blog post. Those details still apply.

The script is now split in 2 parts. One for detection and one for remediation.

The scripts supports modifying following settings in Microsoft Teams:

  • Auto-start application
  • Open application in background
  • On close, keep the application running
  • Disable GPU hardware acceleration
  • Register Teams as the chat app for Office
  • Application language
  • Application theme

Detect-TeamsAppSettings.ps1

Find the Detect-TeamsAppSettings script on my GitHub page: Powershell/Detect-TeamsAppSettings.ps1 at master · imabdk/Powershell (github.com)

This script detects if Microsoft Teams is configured as desired, and will exit with either exit code 1 (not configured as desired) or exit code 0 (configured as desired).

Modify the param region to suit your environment.

Example: If you want to configure Microsoft Teams to be running with Danish UI, Dark theme as well as having the application to start with Windows in the background, go ahead configure the parameters similar to below illustration:

Configure-TeamsAppSettings.ps1

Find the Configure-TeamsAppSettings script on my GitHub page: Powershell/Configure-TeamsAppSettings.ps1 at master · imabdk/Powershell (github.com)

This script stops the Teams process and makes the necessary changes to the Teams config.json. It’s required to stop the Teams process, as well as to delete a cookie file, in order to successfully apply the changes to the config.json.

OBS: Make sure to configure the param region, so it matches that of the detection script. Otherwise, you will never see a happy status in Proactive Remediations and the remediation script will run again and again.

Microsoft Endpoint Manager

Head into the Microsoft Endpoint Manager admin center: https://endpoint.microsoft.com

And locate the Proactive Remediations feature within the Reports -> Endpoint Analytics blade:

Settings

Use the 2 scripts explained above and as illustrated below:

Assignments

Assign the scripts to run on a group consisting of devices or users. In this scenario, I’m running the scripts Hourly on a group containing my own devices.

OBS: Remember that the remediation script stops and starts the Teams process. This is a thing to consider, when assigning a schedule. You don’t want to end up in a scenario, where the Teams process is stopped every hour for your users.

In Action

Taking a closer look on IntuneManagementExtension.log (C:\ProgramData\Microsoft\IntuneManagementExtension\Logs) you will see if the detection script finds that settings needs to be configured:

If so, the remediation script will kick off and make the relevant changes:

Additional info

With the script of configuring Microsoft Teams now being separated into 2, using this with Compliance Settings (Configuration Item and Baseline) in Configuration Manager is pretty straightforward. For the completeness of this, I might do a blog post on how to set this up in the near furture.

When done, then I’ve shown how to configure Microsoft Teams using a regular package (ConfigMgr), using Compliance Settings (ConfigMgr) and with this post, using Intune as well.

ENJOY 🙂

8 thoughts on “Configure Microsoft Teams application settings using PowerShell and Proactive Remediations in Microsoft Endpoint Manager”

  1. Hi,

    Thanks for your time.
    For me, I have always the same problem “Register Teams as the chat app for Office” is not enabled

    All parameters are OK, except this one

    Reply
    • Right. I think I know why and it’s because I assume that “HKCU:\SOFTWARE\IM Providers” exists for the user already, but I can now see scenarios where this doesn’t exist and if that’s the case, the script won’t set the option for you. You can change this in the configure script to always modify the registry, which is needed.

      Reply
  2. It’s not the first script I’m trying 😉

    Thanks for your help.
    Have you an idea?

    The problem is that I have the value of teams in
    HKEY_CURRENT_USER\SOFTWARE\IM Providers
    DefaultIMApp : Teams

    The log of the script:
    COMMENTAIRES : Application: Microsoft Teams is installed in C:\Users\[username]\AppData\Local\Microsoft\Teams.
    Application version is 1.4.00.8872
    COMMENTAIRES : Teams installation found in C:\Users\[username]\AppData\Local\Microsoft\Teams
    COMMENTAIRES : Teams config found in C:\Users\[username]\AppData\Roaming\Microsoft\Teams\desktop-config.json
    COMMENTAIRES : Teams is running. Trying to stop the process
    COMMENTAIRES : Teams process successfully stopped

    DefaultIMApp : Teams
    PSPath : Microsoft.PowerShell.Core\Registry::HKEY_CURRENT_USER\SOFTWARE\IM Providers
    PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_CURRENT_USER\SOFTWARE
    PSChildName : IM Providers
    PSDrive : HKCU
    PSProvider : Microsoft.PowerShell.Core\Registry

    COMMENTAIRES : Creating and converting new content to Teams config file
    COMMENTAIRES : Successfully applied new content to Teams config file at
    C:\Users\[username]\AppData\Roaming\Microsoft\Teams\desktop-config.json
    COMMENTAIRES : Launching Microsoft Teams post processing config changes
    All good. Successfully applied config changes and re-launched Teams. Exiting script with 0

    Reply
  3. Hi Martin! Thanks for your post!
    Do you know where the “Turn off animations (requires restarting Teams)” configuration is saved? Because I can’t find it in the .json file. Thank you!!

    Reply
    • Is this a new setting? I’m not familiar with it. Have you tried to run and watch whats happening with procmon?

      Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.