Jul 10 2019 10:40 PM
Hello,
I have a question on Teams setting file desktop-config.json.
In the company, after installing Teams we must do some preset settings, for example, prevent Teams from auto-starting with system. I think there's an easy way:
$settings = Get-Content "$env:APPDATA\Microsoft\Teams\desktop-config.json" | ConvertFrom-Json
$disable_autostart = "{`"openAtLogin`": false}" | ConvertFrom-Json
$settings | Add-Member -MemberType NoteProperty -Name "appPreferenceSettings" -Value $disable_autostart
$settings | ConvertTo-Json | Set-Content "$env:APPDATA\Microsoft\Teams\desktop-config.json"
$Teams_config_file = "$env:APPDATA\Microsoft\Teams\desktop-config.json"
$disable_auto_start = ",`"appPreferenceSettings`":{`"openAtLogin`":false}}"
(Get-Content $Teams_config_file -Raw) -replace "}$",$disable_auto_start | Set-Content -LiteralPath $Teams_config_file
Aug 06 2019 01:15 AM
@chenrylee
Hi,
maybe a bit late but check the how the coding of the .json file output is.
The .json written back to file system most probably contains BOM (Byte Order Marks) which the original file doesn't!
You can check this if you look at the file in HEX. If your file starts with EF BB BF byte order marks are set for your file.
Teams is ignoring this file and will overwrite it with its default.
One way to provide is using a .NET function as there is no BOM set:
Hope this helps!
Best regards,
JF
Nov 20 2020 07:02 AM
@chenrylee I suppose you found this one by now:
https://devblogs.microsoft.com/scripting/configuring_startup_settings_in_microsoft_teams_with_window...