Forum Discussion
chenrylee
Jun 28, 2019Brass Contributor
How to Prevent Teams from Auto-Launch
Hi guys, I plan to deploy Teams in my company, and there's a headache. I don't want Teams auto launches when system starts, and when I install it, I use this script: msiexec /i "%temp%\Teams_w...
- Jun 28, 2019Hi chenrylee
AFAIK, not currently possible. Whilst you can script it or have a user uncheck it in the settings it does not occur by default
There are multiple uservoices of disabling the start up option, such as this
https://microsoftteams.uservoice.com/forums/555103-public/suggestions/33728680-disable-startup-option
There is one here to turn off autostart for the entire tenant which may be closer to what you need.
https://microsoftteams.uservoice.com/forums/555103-public/suggestions/33922291-disbale-autostart-in-teams-app-for-the-entire-tena
If these don't cover exactly what you need I would raise this as a new uservoice. To note however, it could be some time to get picked up and really, I think the general desire from organisations to use Teams is more to have autostart on by default rather than off
Hope that answers your question!
Best, Chris
chenrylee
Jul 03, 2019Brass Contributor
I find a workaround. Teams settings are stored in a json file, so after installation, I can change the settings by a post-installation script which modifies the configuration file.
#region: Prevent Teams from auto-start
# If Teams auto-start entry exists, delete it
$entry = $null -eq (Get-ItemProperty HKCU:\Software\Microsoft\Windows\CurrentVersion\Run)."com.squirrel.Teams.Teams"
if ( !$entry ) {
Remove-ItemProperty HKCU:\Software\Microsoft\Windows\CurrentVersion\Run -Name "com.squirrel.Teams.Teams"
}
# Define Teams configuratin file path
$Teams_config_file = "$env:APPDATA\Microsoft\Teams\desktop-config.json"
$configs = Get-Content $Teams_config_file -Raw
# If Teams already doesn't auto-start, break out the script.
if ( $configs -match "openAtLogin`":false") {
break
}
# If Teams already ran, and set to auto-start, change it to disable auto-start
elseif ( $configs -match "openAtLogin`":true" ) {
$configs = $configs -replace "`"openAtLogin`":true","`"openAtLogin`":false"
}
# If it's a fresh file, add configuration to the end
else {
$disable_auto_start = ",`"appPreferenceSettings`":{`"openAtLogin`":false}}"
$configs = $configs -replace "}$",$disable_auto_start
}
# Overwritten the configuration with new values.
$configs | Set-Content $Teams_config_file
#endregion