The new Teams client is now a MSIX that we need to deploy. We have a tool for this called teamsbootstrapper.exe which gets new features all the time. The official Microsoft documentation can be found here Bulk deploy the new Microsoft Teams desktop client – Microsoft Teams | Microsoft Learn
Teamsbootstrapper.exe support both online and offline installation of the Teams MSIX file, where online downloads the latest MSIX installer dynamically. We could deploy the MSIX using Intune/Configuration Manager but then we need to update the MSIX file from time to time to not deploy an old version to new clients.
My coworker Sassan (@sassan_f) wrote a PowerShell script that will make the deployment easier and dynamic by downloading the latest teamsbootstrapper.exe as well dynamically so we don’t have to update our application in Intune or Configuration Manager when it is updated. It can be downloaded here: CodeDump/Install-MSTeams.ps1 at main · suazione/CodeDump · GitHub
It also includes a switch when present, will configure RunOnce registry value for the Default User profile and all existing profiles to speed up installation of MSTeams after a user sign in. The RunOnce key will be deleted when uninstalling MSTeams using -Uninstall. If there is an active currently logged on user, a scheduled task will be be created that installs MSTeams as an AppxPackage to speed up the installation.
The script works both in Intune and in Configuration Manager.
Sample install command line:
%windir%\Sysnative\WindowsPowerShell\v1.0\PowerShell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -File “.\Install-NewTeams.ps1” -ForceInstall
Powershell is used as detection method and can be as simple as:
if (“MSTeams” -in (Get-ProvisionedAppPackage -Online).DisplayName) { Write-Output “Installed” }
CommandLine parameters for the script
PARAMETER EXE
The name of the executable file for the MSTeams installation bootstrapper. Default is “Teamsbootstrapper.exe”.
PARAMETER MSIX
The name of the MSIX file for offline installation of MSTeams, only required if using -Offline. Default is “MSTeams-x64.msix”.
PARAMETER LogFile
The path to the log file where the install/uninstall process will be logged. Default is “$env:TEMP\Install-MSTeams.log”.
PARAMETER Offline
A switch parameter that, when present, will initiate an offline installation of MSTeams using the local MSIX file.
PARAMETER Uninstall
A switch parameter that, when present, will deprovision MSTeams using the Teamsbootstrapper.exe and uninstall the MSTeams AppcPackage for AllUsers. Uninstall will delete the registry key: HKLM\Software\Wow6432Node\Microsoft\Office\Teams that can can block installations of MSTeams.
Uninstall will attempt to remove InstallMSTeams RunOnce registry item for Default User and existing profiles that may have been set by SetRunOnce.
PARAMETER ForceInstall
A switch parameter that, when present, will uninstall and deprovision MSTeams before attempting installation. It will also delete the registry key: HKLM\Software\Wow6432Node\Microsoft\Office\Teams that can can block the installation of MSTeams.
PARAMETER SetRunOnce
A switch parameter that, when present, will configure RunOnce registry value for the Default User profile and all existing profiles to speed up installation of MSTeams after a user sign in. The RunOnce key will be deleted when uninstalling MSTeams using -Uninstall.
If there is a active currently logged on user, a scheduled task will be be created that installs MSTeams as an AppxPackage to speed up the installation.
PARAMETER DownloadExe
A switch parameter that, when present, will attempt to download teamsbootstrapper.exe from Microsoft and verify its digital signature. Using this parameter removes the need to include a local teamsbootstrapper.exe. Has to be specified for -Uninstall as well.
To deploy it create a Win32app with or without the teamsbootstrapper.exe and/or MSIX file depending on your preferences and requirements.
Great work Sassan! Hope this will make Intune/Configuration Manager admins life easier deploying the new Teams client.
Hi,
This script is awesome! Thanks for sharing this.
I have a question. What detection method should be used?
Please advise.
Thanks
Hi! Thanks, happy you find it useful. 🙂
There are two example detection methods in the scripts help section.
if (“MSTeams” -in (Get-ProvisionedAppPackage -Online).DisplayName) { Write-Output “Installed” }
@Tariq, in the article he states:
Powershell is used as detection method and can be as simple as:
if (“MSTeams” -in (Get-ProvisionedAppPackage -Online).DisplayName) { Write-Output “Installed” }
exactly same question you cant use path cause its path always change
C:\Program Files\WindowsApps\MSTeams_23320.3021.2567.4799_x64__8wekyb3d8bbwe
so only way i find is PS to detect if exist C:\Program Files\WindowsApps\MSTeams*
another pro app from microsoft 😀
Hi, great script. Works like a charm.
However, after install Teams New language is Dutch. I want it to be English.
The Windows 11 installation is English, the locale is Dutch. How to make sure Teams is also in English.
Thanks in advance.
Can you type out the entire Install/Uninstall command you are using? They are cut off in the image.
Thanks a lot for sharing.
Exactly why use SetRunOnce parameter ?
Thanks
Excellent script. Can this be deployed in SCCM to systems, whether or not users logged in? Or does it have to be deployed to devices in the user context ?
this is a great resource.
Out of curiosity, with the powershell, do we have to download the msix file manually? It only seems to indicate that the bootstrapper is downloaded with this script
Hi, No you can choose to but no, the bootstrapper will download it for you so it always is the latest.
Regards,
Jörgen
Thanks for that.
So to do this in offline mode and not download anything manually, is this correct?
\Install-MSTeams.ps1″ -DownloadExe -Offline -ForceInstall
Hi, I might be being silly but how do you push out the script in Intune so it can be run by the Win32 install command?
THANK YOU! THANK YOU! I have been searching for a proper way to deploy the new Teams for weeks. Patience and perseverance finally got paid off. Thank you for the powershell script!
Hi Jorgen, love this script. Is there anyway you can add the removal of the teams-machinewide installer.
Similar to what’s in this script:
https://scloud.work/new-teams-client-and-cleanup-the-classic-intune/
https://github.com/suazione/CodeDump/blob/main/Install-MSTeams.ps1
Thanks
Alan
So first i need to package the script as a .intunewin file? win32 apps in intune requires intunewin or that am i missing :s
If sending via an Config Mgr application deployment, using “.\Install-NewTeams.ps1” -ForceInstall -RunOnce command, that runs under system context and won’t have access to the internet to download lastest MSIX, correct?
How can I make this work?
Hello, Thank you for your script I’ve a couple of questions/remarks.
– Custom SCCM Detection is based on the target of the deployment, so a simple check for provisionedapppackage only works if the target is machine, not of the target is user. Maybe you can add a line for that?
StevenM2330 added a comment in the MS Tech article about this: https://techcommunity.microsoft.com/t5/microsoft-teams-blog/new-microsoft-teams-bulk-installer-is-now-available-for-windows/ba-p/4046286
– I’ve an issue with multi user computers, the installation works great for the first user, but when another user logs on Teams won’t start and is greyed out in the start menu. Do more people experience this? Any Tips?
hello,
i got it working for installation…but the uninstall parameter gives me the following
givin an error when uninstalling trough sccm
thank you
PowerShell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -File “.\Install-NEWTeams.ps1” -Uninstall
2024-03-07 22:26:40: ### Starting Install-MSTeams execution ###
2024-03-07 22:26:40: Attempting to uninstall MSTeams
2024-03-07 22:26:41: MSTeams AppxPackage is currently NOT installed for any user
2024-03-07 22:26:41: MSTeams ProvisionedAppPackage (MSTeams_24004.1309.2689.2246_x64__8wekyb3d8bbwe) is currently installed
2024-03-07 22:26:41: Teamsbootstrapper.exe version is 1.0.2402201
2024-03-07 22:26:42: Error uninstalling MSTeams: @{success=True}
2024-03-07 22:26:43: MSTeams AppxPackage is currently NOT installed for any user
2024-03-07 22:26:43: MSTeams ProvisionedAppPackage (MSTeams_24004.1309.2689.2246_x64__8wekyb3d8bbwe) is currently installed
Hi,
Does the script work for upgrading Teams or just for new installs? I’m using Intune and it only installed for my test laptop that did not have the classic Teams. It hasn’t reported anything back for my other test laptop that currently have classic Teams installed. TIA.
Hi, everything worked correctly in the Task Sequence with SCCM but there is no Teams installed on Pc. It also says “installed” in Logs . Why is that?
Hi all,
I’m trying to setup my SCCM like this :
PowerShell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -File “Install-MSTeams.ps1” -DownloadExe -SetRunOnce -ForceInstall
So it will download the latest latest bootstrapper and thus deploy the latest NEW Teams and perform it for the default users + existing
The uninstall would be
PowerShell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -File “Install-MSTeams.ps1” -UnInstall
Am I correct like this?
I had an issue with the script when deploying it as an available application with the online switch for employees to install it, the first time after instating teams the deployment failed an no teams was installed the second time when installing it again from SC it was successful and teams 2.0 was installed so I added a tmeout and install command line in the script Install-MSTeams function this fixes the issue.
function Install-MSTeams {
param (
[switch]$Offline
)
if ($Offline) {
$Result = & “$EXEFolder\$EXE” -p -o “$MSIXFolder\$MSIX”
}
else {
Start-Sleep 10
$Result = & “$EXEFolder\$EXE” -p
Start-Sleep 10
$Result = & “$EXEFolder\$EXE” -p
}
$ResultPSO = try { $Result | ConvertFrom-Json } catch {$null}
if ($null -ne $ResultPSO) {
return $ResultPSO
}
else {
return $Result
}
}
I also added a close teams command in the uninstall function.
function Uninstall-MSTeams {
Stop-Process -Name ms-teams -Force
Log “Running Uninstall-MSTeams function” -NoOutput
$Appx = Get-AppxPackage -AllUsers | Where-Object {$PSItem.Name -eq “MSTeams”}
if ($Appx) {
Log “MSTeams $($Appx.Version) package is installed for these users: $($Appx.PackageUserInformation.UserSecurityId.UserName)” -NoOutput
Log “Uninstalling AppxPackage for AllUsers” -NoOutput
$Appx | Remove-AppxPackage -AllUsers
}
Log “Deprovisioning MSTeams using $EXE” -NoOutput
$Result = & “$EXEFolder\$EXE” -x
$ResultPSO = try { $Result | ConvertFrom-Json } catch {$null}
if ($null -ne $ResultPSO) {
return $ResultPSO
}
else {
return $Result
}
}
If doing the offline install, does the msix file needs to be in the same directory as the script??
Hi, Yes that is correct
Regards,
Jörgen
I’ve been able to get this to deploy from Software Center on an already imaged PC, however I’m having trouble incorporating this into our imaging task sequence. I’ve tried using the install application step in the task sequence, however after imaging completes, the start menu shows the icon, but the application is not installed. The application deployment programs are listed below…
Installation program:
%windir%\Sysnative\WindowsPowerShell\v1.0\PowerShell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -File “.\Install-MSTeams.ps1” -Offline -SetRunOnce
Uninstall program:
%windir%\Sysnative\WindowsPowerShell\v1.0\PowerShell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -File “.\Install-MSTeams.ps1” -Uninstall
Does anyone have any suggestions on how I can incorporate this into our imaging task sequence? I’m striking out with everything I try. I guess I could set it to install from software center when the user first logs into the computer but not ideal.
We have a lot of multi-use machines. If one user has said yes to use the new teams, the detection script shows that New Teams is installed and does not uninstall the Classic teams from the other users profiles. Do you have a detection script so that is Classic Teams is installed, it will not detect the New Teams so the script will run?
Hey guys, can we get the uninstall command pasted somewhere in the article?
Thanks
for vdi https://gist.github.com/aaronparker/a1af077b46505f48e7b09d3d6fdfcdcd
and with some cleaning https://github.com/FlorianSLZ/scloud/blob/main/Program%20-%20win32/Microsoft%20Teams%20(new)/install.ps1
Cant get this to work – we are deploying with SCCM and getting error 0xFFFD0000(-196608)
It works if we start PS with admin rights and runs the same commandlet as from CM server
Here is the AppEnforce log: