Forum Discussion
Bulk deploy the Teams auto start setting
In the blog post announcing the release of the TeamsBootstrapper.exe utility for deploying the New Teams client for Windows, it references an upcoming "auto start support" feature where the utility could be used to configure Teams to automatically launch when new users sign in for the first time.
It's been over a year and there has been no update on this. I posted a comment on the blog post last week but there has been no response.
Has this new feature been abandoned? Is there another supported way to do this? (Can I just mount
C:\Users\Default\NTUSER.DAT
and throw a value in
Software\Microsoft\Windows\CurrentVersion\RunOnce
pointing to
C:\Program Files\WindowsApps\MSTeams_25072.1609.3541.7814_x64__8wekyb3d8bbwe\ms-teams.exe
?)
Having not had a response here, I asked the same question in the Windows Office Hours yesterday. Didn't get a response there either. No big surprise.
So, I spent a few hours this afternoon trying to figure out if the potential solution I suggested would work. It does, sort of. The problem is it seems to take over 10 minutes for the Teams app to install in the user's profile after they sign in. As a workaround for that, the command I drop in the RunOnce key runs a PowerShell script that checks every 10 seconds to see whether "ms-teams" is a valid command. Once it is, it runs it. Pretty janky, but better than nothing, maybe?
Anyway, here is my Intune remediation detection script:
$detected = 0 $defaultRunOncePath = 'Default:\Software\Microsoft\Windows\CurrentVersion\RunOnce' if(-not (Get-ProvisionedAppxPackage -Online | Where-Object { $_.DisplayName -eq "MSTeams" })) { Write-Host 'Teams is not installed' Exit 0 } reg 'load' 'HKU\Default' 'C:\Users\Default\NTUSER.DAT' New-PSDrive -Name 'Default' -PSProvider Registry -Root 'HKU\Default' | Out-Null if(-not (Test-Path -Path 'Default:')) { Write-Error 'Could not load default user registry hive' Exit 0 } if ((Get-Item $defaultRunOncePath -ErrorAction Ignore).Property -contains 'ms-teams') { Write-Host 'The ms-teams reg value already exists in the default user RunOnce' $detected = 1 } else { Write-Host 'The ms-teams reg value was not found in the default user RunOnce' } Remove-PSDrive -Name 'Default' [GC]::Collect() reg 'unload' 'HKU\Default' Exit $detected
And here's the remediation script:
$defaultRunOncePath = 'Default:\Software\Microsoft\Windows\CurrentVersion\RunOnce' $cmd = @" Powershell -NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -Command "& { do {Start-Sleep 10} until (Get-Command ms-teams -ErrorAction SilentlyContinue); Start-Process ms-teams }" "@ reg 'load' 'HKU\Default' 'C:\Users\Default\NTUSER.DAT' New-PSDrive -Name 'Default' -PSProvider Registry -Root 'HKU\Default' | Out-Null if(-not (Test-Path -Path 'Default:')) { Write-Error 'Could not load default user registry hive' Exit 0 } if(-not (Test-Path -Path $defaultRunOncePath)) { New-Item -Path $defaultRunOncePath -Force } Set-ItemProperty -Path $defaultRunOncePath -Name 'ms-teams' -Value $cmd Remove-PSDrive -Name 'Default' [GC]::Collect() reg 'unload' 'HKU\Default'
Disclaimer: I haven't actually tried deploying this with Intune yet. I've only run the scripts directly on my machine. Use at your own risk, obviously.
1 Reply
- RyanSteele-CoVIron Contributor
Having not had a response here, I asked the same question in the Windows Office Hours yesterday. Didn't get a response there either. No big surprise.
So, I spent a few hours this afternoon trying to figure out if the potential solution I suggested would work. It does, sort of. The problem is it seems to take over 10 minutes for the Teams app to install in the user's profile after they sign in. As a workaround for that, the command I drop in the RunOnce key runs a PowerShell script that checks every 10 seconds to see whether "ms-teams" is a valid command. Once it is, it runs it. Pretty janky, but better than nothing, maybe?
Anyway, here is my Intune remediation detection script:
$detected = 0 $defaultRunOncePath = 'Default:\Software\Microsoft\Windows\CurrentVersion\RunOnce' if(-not (Get-ProvisionedAppxPackage -Online | Where-Object { $_.DisplayName -eq "MSTeams" })) { Write-Host 'Teams is not installed' Exit 0 } reg 'load' 'HKU\Default' 'C:\Users\Default\NTUSER.DAT' New-PSDrive -Name 'Default' -PSProvider Registry -Root 'HKU\Default' | Out-Null if(-not (Test-Path -Path 'Default:')) { Write-Error 'Could not load default user registry hive' Exit 0 } if ((Get-Item $defaultRunOncePath -ErrorAction Ignore).Property -contains 'ms-teams') { Write-Host 'The ms-teams reg value already exists in the default user RunOnce' $detected = 1 } else { Write-Host 'The ms-teams reg value was not found in the default user RunOnce' } Remove-PSDrive -Name 'Default' [GC]::Collect() reg 'unload' 'HKU\Default' Exit $detected
And here's the remediation script:
$defaultRunOncePath = 'Default:\Software\Microsoft\Windows\CurrentVersion\RunOnce' $cmd = @" Powershell -NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -Command "& { do {Start-Sleep 10} until (Get-Command ms-teams -ErrorAction SilentlyContinue); Start-Process ms-teams }" "@ reg 'load' 'HKU\Default' 'C:\Users\Default\NTUSER.DAT' New-PSDrive -Name 'Default' -PSProvider Registry -Root 'HKU\Default' | Out-Null if(-not (Test-Path -Path 'Default:')) { Write-Error 'Could not load default user registry hive' Exit 0 } if(-not (Test-Path -Path $defaultRunOncePath)) { New-Item -Path $defaultRunOncePath -Force } Set-ItemProperty -Path $defaultRunOncePath -Name 'ms-teams' -Value $cmd Remove-PSDrive -Name 'Default' [GC]::Collect() reg 'unload' 'HKU\Default'
Disclaimer: I haven't actually tried deploying this with Intune yet. I've only run the scripts directly on my machine. Use at your own risk, obviously.