Menu
CCMEXEC.COM – Enterprise Mobility
  • Home
  • General
  • Configuration Manager
  • Windows 10
  • Windows 11
  • Intune
  • GitHub
  • About
CCMEXEC.COM – Enterprise Mobility

Install New Teams client with PowerShell with or without content

Posted on November 27, 2023November 28, 2023 by Jörgen Nilsson

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.  

35 thoughts on “Install New Teams client with PowerShell with or without content”

  1. Tariq says:
    November 27, 2023 at 7:40 pm

    Hi,

    This script is awesome! Thanks for sharing this.

    I have a question. What detection method should be used?

    Please advise.

    Thanks

    Reply
    1. Sassan says:
      November 27, 2023 at 11:02 pm

      Hi! Thanks, happy you find it useful. 🙂
      There are two example detection methods in the scripts help section.

      Reply
    2. Andrew says:
      November 28, 2023 at 10:15 pm

      if (“MSTeams” -in (Get-ProvisionedAppPackage -Online).DisplayName) { Write-Output “Installed” }

      Reply
    3. Jesus says:
      November 28, 2023 at 11:13 pm

      @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” }

      Reply
    4. MareK says:
      December 18, 2023 at 1:00 pm

      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 😀

      Reply
  2. Paul says:
    November 28, 2023 at 11:49 am

    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.

    Reply
  3. Dave says:
    November 28, 2023 at 2:58 pm

    Can you type out the entire Install/Uninstall command you are using? They are cut off in the image.

    Reply
  4. Pingback: Intune Newsletter - 1st December 2023 - Andrew Taylor
  5. Pietro Corti says:
    December 18, 2023 at 2:29 pm

    Thanks a lot for sharing.
    Exactly why use SetRunOnce parameter ?
    Thanks

    Reply
  6. David Lowe says:
    January 15, 2024 at 8:43 pm

    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 ?

    Reply
  7. Nik says:
    February 7, 2024 at 10:49 pm

    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

    Reply
    1. Jörgen Nilsson says:
      February 8, 2024 at 8:52 am

      Hi, No you can choose to but no, the bootstrapper will download it for you so it always is the latest.
      Regards,
      Jörgen

      Reply
      1. Nik says:
        February 13, 2024 at 10:50 pm

        Thanks for that.

        So to do this in offline mode and not download anything manually, is this correct?

        \Install-MSTeams.ps1″ -DownloadExe -Offline -ForceInstall

        Reply
  8. Jeffrey says:
    February 15, 2024 at 4:36 am

    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?

    Reply
  9. mplas says:
    February 16, 2024 at 11:03 pm

    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!

    Reply
  10. alan yousif says:
    February 27, 2024 at 4:56 pm

    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

    Reply
  11. Anders says:
    March 5, 2024 at 11:26 am

    So first i need to package the script as a .intunewin file? win32 apps in intune requires intunewin or that am i missing :s

    Reply
  12. Steve says:
    March 5, 2024 at 10:19 pm

    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?

    Reply
  13. TC says:
    March 6, 2024 at 8:21 am

    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?

    Reply
  14. bart says:
    March 7, 2024 at 10:31 pm

    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

    Reply
  15. Linh says:
    March 15, 2024 at 10:54 pm

    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.

    Reply
  16. ezgi altug says:
    March 18, 2024 at 8:46 pm

    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?

    Reply
  17. Sophie says:
    April 24, 2024 at 5:11 pm

    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?

    Reply
  18. Remy Kuster says:
    June 10, 2024 at 9:39 am

    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
    }
    }

    Reply
  19. Yevgeniy Levin says:
    June 11, 2024 at 7:42 am

    If doing the offline install, does the msix file needs to be in the same directory as the script??

    Reply
    1. Jörgen Nilsson says:
      June 11, 2024 at 8:29 am

      Hi, Yes that is correct
      Regards,
      Jörgen

      Reply
  20. TimRedBeard says:
    June 14, 2024 at 9:23 pm

    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.

    Reply
  21. Donna Gordon says:
    June 30, 2024 at 6:15 pm

    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?

    Reply
  22. Hrvoje says:
    July 1, 2024 at 10:48 am

    Hey guys, can we get the uninstall command pasted somewhere in the article?

    Thanks

    Reply
  23. Claudio MENDES says:
    July 24, 2024 at 2:10 pm

    for vdi https://gist.github.com/aaronparker/a1af077b46505f48e7b09d3d6fdfcdcd

    Reply
  24. Claudio MENDES says:
    July 30, 2024 at 10:46 am

    and with some cleaning https://github.com/FlorianSLZ/scloud/blob/main/Program%20-%20win32/Microsoft%20Teams%20(new)/install.ps1

    Reply
  25. Sebasthian Persson says:
    August 21, 2024 at 10:32 am

    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:

    Reply
    1. David says:
      September 9, 2024 at 3:54 pm

      I am experiencing the same issue, did you manage to solve this?

      Reply
    2. Erin Day says:
      October 4, 2024 at 6:50 pm

      This is happening to us as well for remote users, although in testing in the office it was fine? Did you resolve this?

      Reply
  26. Raimundas says:
    September 19, 2024 at 1:12 pm

    i have from sccm when i uninstall, error uninstalling MSTEams @{Sucess=True} i need reboot device and then try it agin, then it works, any clue why? it is not kicking teams sessions during uninstall.

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

My name is Jörgen Nilsson and I work as a Senior Consultant at Onevinn in Malmö, Sweden. This is my blog where I will share tips and stuff for my own and everyone elses use on Enterprise Mobility and Windows related topics.
All code is provided "AS-IS" with no warranties.

Recent Posts

  • New settings in Intune Security Baseline Windows 11 24H2 -2504
  • Managing extensions in Visual Studio Code
  • Reinstall a required Win32app using remediation on demand
  • Administrator protection in Windows 11 – First look
  • Remediation on demand script – ResetWindowsUpdate
©2025 CCMEXEC.COM – Enterprise Mobility | WordPress Theme by Superb Themes
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish.Accept Reject Read More
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT