Teams for non-persistent environments require specific installation procedures to work correctly with acceleration. However, it has been noticed that updating the Teams machine-wide installer may not update the underlying Teams install. To address this I have created this Powershell script to download and update the Teams files programmatically. This function is also part of my machine update and sealing process.
$TeamsDownloadURI = "https://teams.microsoft.com/downloads/desktopurl?env=production&plat=windows&arch=x64&managedInstaller=true&download=true"
Start-Transcript -Path (Join-Path $env:TEMP “Teams.log”) -Append -Force
#Start download
Write-Host “Starting download latest Teams client”
Invoke-WebRequest -Uri $TeamsDownloadURI -OutFile (Join-Path “$($env:TEMP)” “Teams_windows_x64.msi”)
Write-Host “Initialize Teams Setup with allusers argument…”
$TeamsSetup = (Join-Path “$($env:TEMP)” “Teams_windows_x64.msi”)
$ExecuteSetup = ” allusers=1 alluser=1 OPTIONS=noAutoStart=true”
Write-Host “Now time to install Teams in program folder $($TeamsSetup)$($ExecuteSetup)”
$file = ‘C:\Program Files (x86)\Teams Installer’
#Check if this is a new install or an upgrade
if (-not(Test-Path -Path $file)) {
$proc = Start-Process -FilePath “C:\Windows\System32\msiexec.exe” -ArgumentList “-i $($TeamsSetup)$($ExecuteSetup)” -PassThru
$proc.WaitForExit()
}
# Upgrade
else {
Uninstall-Package -Name “Teams Machine-Wide Installer” -Force
$proc2 = Start-Process -FilePath “C:\Windows\System32\msiexec.exe” -ArgumentList “-i $($TeamsSetup)$($ExecuteSetup)” -PassThru
$proc2.WaitForExit()
}
Write-Host “TeamsSetup exit code: $($proc.ExitCode)”