This is the solution that I have come up with that works in my environment. I cannot speak to how this may work in other environments. 

Begin by packaging just the teamsboostrapper.exe and a Powershell Script for the uninstall with the “Microsoft-Win32-Content-Prep-Tool” (https://github.com/Microsoft/Microsoft-Win32-Content-Prep-Tool). 

-Uninstall Powershell Script:

Get-AppxPackage *MSTeams* -AllUsers | Remove-AppxPackage -AllUsers

Download an Icon from Google for MS Teams for Company Portal, if you decide to set it as available


-Sidenote: If you have never used the Win32 Content Prep Tool here’s a quick rundown. Extract the files from the GitHub download to a location of your choosing. Run the “IntuneWinAppUtil.exe” as an administrator. The utility first asks for a Source Folders file path. The Source Folder is the “Package” that gets compressed and encrypted when you use the Utility. For instance, I will name my source folder “Package” and it will hold the application I want to push, such as teamsbootstrapper.exe. 

Next, it will ask for a “Setup File” This will be the Install file within your source folder. For instance, teamsbootstrapper.exe will be the install file in my scenario, so I specify just the name of the file, teamsbootstrapper.exe. 

Next, it will ask for an “Output Folder” This is where you want the generated “.IntuneWinFile” to be outputted. 

Next, it will ask if you want to specify a “catalog folder” You can hit “N” for No.


App Information: 

Name: Microsoft Teams

-When deploying the latest version of Teams I’ve noticed it no longer says “(New)” in the title of it. The Classic client of Teams is no longer supported as of July 1, 2024. 

Description: Microsoft Teams is the ultimate messaging app for your organization—a workspace for real-time collaboration and communication, meetings, file and app sharing, and even the occasional emoji! All in one place, all in the open, all accessible to everyone.

Information URL: https://support.microsoft.com/en-us/topic/what-is-microsoft-teams-3de4d369-0167-8def-b93b-0eb5286d7a29#:~:text=Microsoft%20Teams%20is%20the%20ultimate,open%2C%20all%20accessible%20to%20everyone.

Privacy URL: https://learn.microsoft.com/en-us/microsoftteams/privacy/teams-privacy

Developer: Microsoft

Icon:

Program:

Installation Command: teamsbootstrapper.exe -p

Uninstall Command: Powershell.exe -NoProfile -ExecutionPolicy ByPass -File .\UninstallMSTeams.ps1

-You could also try using the Uninstall Command “teamsbootsrapper.exe -x” however, I find that not to be very reliable and requires a restart usually. 

Requirements:

To your choosing

Detection Rule: 

# Path for MS Teams
$teamsappx = Get-AppxPackage *MSTeams* -AllUsers
# Verify if MS Teams is Installed
if ($teamsappx) {
    # Display message if Microsoft Teams is found
    Write-Host "MS Teams New is installed."
    exit 0

} else {

    # Display message if Microsoft Teams is not found
    Write-Host "Microsoft Teams client not found."
    exit 1

}

Dependencies:

To your choosing. 

-You could use Powerscript packaged as a Win32 app to remove the Classic Client of Teams before installing this new client. I’ll put a script below that I use to remove the Classic Teams Client. The original script is from a forum that I cannot recall the author of. Mine is slightly modified, I’ve added a few steps.


Stop-Process -Name "Teams"

function Uninstall-TeamsClassic($TeamsPath) {
    try {
        $process = Start-Process -FilePath "$TeamsPath\Update.exe" -ArgumentList "--uninstall /s" -PassThru -Wait -ErrorAction STOP
        if ($process.ExitCode -ne 0) {
            Write-Error "Uninstallation failed with exit code $($process.ExitCode)."
        }
    }
    catch {
        Write-Error $_.Exception.Message
    }
}

# Remove Teams Machine-Wide Installer
Write-Host "Removing Teams Machine-wide Installer"
## Get all subkeys and match the subkey that contains "Teams Machine-Wide Installer" DisplayName.
$MachineWide = Get-ItemProperty -Path $registryPath | Where-Object -Property DisplayName -eq "Teams Machine-Wide Installer"
if ($MachineWide) {
    Start-Process -FilePath "msiexec.exe" -ArgumentList "/x ""$($MachineWide.PSChildName)"" /qn" -NoNewWindow -Wait
}
else {
    Write-Host "Teams Machine-Wide Installer not found"
}
# Get all Users
$AllUsers = Get-ChildItem -Path "$($ENV:SystemDrive)\Users"
# Process all Users
foreach ($User in $AllUsers) {
    Write-Host "Processing user: $($User.Name)"
    # Locate installation folder
    $localAppData = "$($ENV:SystemDrive)\Users\$($User.Name)\AppData\Local\Microsoft\Teams"
    $programData = "$($env:ProgramData)\$($User.Name)\Microsoft\Teams"
    if (Test-Path "$localAppData\Current\Teams.exe") {
        Write-Host "  Uninstall Teams for user $($User.Name)"
        Uninstall-TeamsClassic -TeamsPath $localAppData
    }
    elseif (Test-Path "$programData\Current\Teams.exe") {
        Write-Host "  Uninstall Teams for user $($User.Name)"
        Uninstall-TeamsClassic -TeamsPath $programData
    }
    else {
        Write-Host "  Teams installation not found for user $($User.Name)"
    }
}
# Remove old Teams folders and icons
$TeamsFolder_old = "$($ENV:SystemDrive)\Users\*\AppData\Local\Microsoft\Teams"
$TeamsIcon_old = "$($ENV:SystemDrive)\Users\*\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Microsoft Teams*.lnk"
Get-Item $TeamsFolder_old | Remove-Item -Force -Recurse
Get-Item $TeamsIcon_old | Remove-Item -Force -Recurse
Start-Sleep -seconds 15

taskkill /f /im explorer.exe
start explorer.exe

Supersedence:

To your choosing. You could use the Classic Teams removal script above as a superseded app as well.

Scope Tag: 

To your choosing.

Assignments: 

To your choosing.


Additional Teams Deploy Stuff: 

For my environment and the users I support, when I removed the old Teams Client, I figured users would freak out, even though they have the New Teams on their machine. I had two options, create a desktop shortcut for the UWP MS Teams app or make a taskbar icon for them. Creating a desktop shortcut was a pain in the butt. I could get the shortcut on the desktop, with the icon without issue however, it would not launch the app. I believe this is because I was creating it using the System/Admin context and deploying it to the public desktop. When I try to run it under the User context, I get an unauthorized error. Instead of doing a desktop shortcut, I went the other route of putting it on the taskbar. I was able to do this using Intunes Configuration Profiles. 

Go to Devices > Configuration Profiles > Create New Policy > Windows 10 and Later > Settings Catalog

Name your policy however you’d like. 

Search for “start layout” and select “start” > “start layout” 

While they give you a very small box to put in your XML, here is the XML that I have set in there. This puts both Company Portal and MS Teams on the taskbar. You can remove the Company Portal line.


<?xml version="1.0" encoding="utf-8"?>
<LayoutModificationTemplate
    xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification"
    xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout"
    xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout"
    xmlns:taskbar="http://schemas.microsoft.com/Start/2014/TaskbarLayout"
    Version="1">
  <CustomTaskbarLayoutCollection>
    <defaultlayout:TaskbarLayout>
      <taskbar:TaskbarPinList>
<taskbar:UWA AppUserModelID="Microsoft.CompanyPortal_8wekyb3d8bbwe!App"/>
<taskbar:UWA AppUserModelID="MSTeams_8wekyb3d8bbwe!app"/>
</taskbar:TaskbarPinList>
    </defaultlayout:TaskbarLayout>
 </CustomTaskbarLayoutCollection>
</LayoutModificationTemplate>