Prerequisites:
User needs to have logged in completely at least once to MS Teams, (the status icon will be visible).
Enable the three settings (see image below) in the Microsoft Teams policy, then click Ok to save the settings.
Note: Only the underlined settings are being reapplied when the policy processes, the other options are not being changed.
Next, create a new Scripts & Triggers policy within the same GPO, under the same configuration side, user or computer that you used in Step 1.
Note: If applying the policy on the computer side choose switched mode like in the screenshot below.
At the “On apply action” screen select “PowerShell script” from the dropdown, then in the main text window, paste in the script below, check the two options “Run script as user” and “Run interactively”, then click “Next”.
Note: Users may initially see two MS Teams icons for a few seconds in the Systray at the same time, however, one of the icons will disappear shortly. Also, if this is the first time logging in since the policy was applied it may take a 2nd login for the policy to kick in.