ms_teams_autorun
This is an old revision of the document!
Deshabilitar el arranque automático de Teams para todos los usuarios.
Usar con los script de inicio en gpedit.msc, user logon scripts.
<#
.SYNOPSIS Disable Teams autorun
.NOTES
-2019-08-30 - Updated to call Stop-Process -Name Teams before modifying config file.
- Set output encoding to UTF8.
-2019-08-12 - Original release
#>
# If Teams autorun entry exists, remove it
$TeamsAutoRun = (Get-ItemProperty HKCU:\Software\Microsoft\Windows\CurrentVersion\Run -ea SilentlyContinue)."com.squirrel.Teams.Teams"
if ($TeamsAutoRun)
{
Remove-ItemProperty HKCU:\Software\Microsoft\Windows\CurrentVersion\Run -Name "com.squirrel.Teams.Teams"
}
# Teams Config Data
$TeamsConfig = "$env:APPDATA\Microsoft\Teams\desktop-config.json"
$global:TeamsConfigData = Get-Content $TeamsConfig -Raw -ea SilentlyContinue | ConvertFrom-Json
# If Teams already doesn't have the autostart config, exit
If ($TeamsConfigData)
{
If ($TeamsConfigData.appPreferenceSettings.openAtLogin -eq $false)
{
# It's already configured to not startup
exit
}
else
{
# If Teams hasn't run, then it's not going to have the openAtLogin:true value
# Otherwise, replace openAtLogin:true with openAtLogin:false
If ($TeamsConfigData.appPreferenceSettings.openAtLogin -eq $true)
{
$TeamsConfigData.appPreferenceSettings.openAtLogin = $false
}
else
# If Teams has been intalled but hasn't been run yet, it won't have an autorun setting
{
$Values = ($TeamsConfigData.appPreferenceSettings | GM -MemberType NoteProperty).Name
If ($Values -match "openAtLogin")
{
$TeamsConfigData.appPreferenceSettings.openAtLogin = $false
}
else
{
$TeamsConfigData.appPreferenceSettings | Add-Member -Name "openAtLogin" -Value $false -MemberType NoteProperty
}
}
# Save
$TeamsConfigData | ConvertTo-Json -Depth 100 | Out-File -Encoding UTF8 -FilePath $TeamsConfig -Force
}
}
ms_teams_autorun.1605478673.txt.gz · Last modified: 2024/10/17 21:42 (external edit)
