Microsoft Teams has a feature that allows you to configure it to open in the background.
By enabling the "Open application in background" setting, Teams stays discreetly in your system tray, while still delivering all notifications and calls.

To set this configuration using Intune, I utilize PowerShell. ❤️

This post is about the "New Teams Client", if you still use the Classic client, I have a similar script for you here: Open Teams Classic in Background | Intune | scloud

Table of Contents

Set how Teams opens via PowerShell

The PowerShell script presented here not only closes any active Teams processes but also adjusts a key configuration parameter within the application. By tweaking the "open_app_in_background" option in the Teams configuration file, we instruct Teams to launch in the background mode by default.

Here's the script:

# End acitve Teams process
if(Get-Process ms-teams -ErrorAction SilentlyContinue){Get-Process ms-teams | Stop-Process -Force}

# Replace/Set "open_app_in_background" option to true
$SettingsJSON = "$ENV:LocalAPPDATA\Packages\MSTeams_8wekyb3d8bbwe\LocalCache\Microsoft\MSTeams\app_settings.json"
(Get-Content $SettingsJSON -ErrorAction Stop).replace('"open_app_in_background":false', '"open_app_in_background":true') | Set-Content $SettingsJSON -ForceCode language: PowerShell (powershell)

The Challange deploying this script

While the PowerShell script presented in the previous section is a effective way to open Microsoft Teams in the background, it's important to be aware of potential challenges that can arise when deploying it directly. These challenges can disrupt a user's work, especially during critical meetings or conversations.

To avoid this, I utilize the "RunOnce function". I've described in a previous blog post:
Run once at Startup - Intune | scloud

Set Teams to open in background via Intune

You can find the full script, ready to use, for download on GitHub:

Once you have the PowerShell script ready to optimize Microsoft Teams for background operation, the next step is to deploy it using Microsoft Intune.

Follow these steps:

  1. Open Intune
  2. Navigate to: "Devices > Windows > Scripts > Platform scripts"
  3. Press "+ Add"
  4. Set a name and description
  5. Upload the script and set the execution settings to:
    Run this script using the logged on credentials: Yes
    Enforce script signature check: No
    Run script in 64 bit PowerShell Host: Yes
  6. Assign the script to your target group

Once the managed device executes the script, the setting will take effect the next time the user logs in. Additionally, the script is removed from the local device after execution, ensuring a clean process.

Change the start behavior as a user

As a user, you can also manually set or change this option with just a few clicks:

  1. Launch Microsft Teams
  2. Open the Setting (three dots in the right in the header)
  3. In the Tab General choos your Start behavior at "Open application in background"

Its important to knwo, that all users can change this setting at any time.

Conclusion

Optimizing Microsoft Teams to open in the background offers a significant productivity boost. We've explored a PowerShell script that achieves this, but deploying it directly can be disruptive.

To address this, we introduced the "RunOnce function," allowing for a smoother, more user-friendly deployment. It empowers both administrators and individual users to customize the experience.