Since Microsoft has released Microsoft Teams, there has been a need for MSI package to deploy it in enterprise environment using software deployment solution (such as SCCM).

Until then, there has been lot of workarounds available on the internet to manage such corporate deployment needs.

Now, Microsoft has released MSI packages (both 32 and 64 bits).

However, there few tricks to keep in mind, like you can not use this package to update Teams; leave Teams update itself.

NOTE you may got notification from the SmartScreen feature if you use Internet Explorer/Edge to download them. Hopefully updated packages will come soon to solve this incorrect warning

image

 

Create the SCCM application package

For this package I’m going to include both MSI and use requirements to detect which one to use but you can create 2 distinct packages and then use device collection to target them.

  • Using SCCM console create a new application and select one of the MSI package

imageimage

NOTE you may got a notification saying SCCM is not able to verify the package; just choose to continue. Hopefully updated packages will come soon to solve this

image

  • Change the install behavior to install for system

image

  • Edit the deployment type to define the requirements for this package
    • For the x32 bits package you must select the Operating System as condition and one of any of the 32 bits supported version of Windows (aka Windows 7 (32 bits), Windows 8 (32 bits), Windows 8.1 (32 bits) and Windows 10 (32 bits)). Off course you are not obliged to select all the supported version, you can select only the ones you have currently deployed
    • For the x64 bits package you must select the Operating System as condition and one of any of the 64 bits supported version of Windows (aka Windows 7 (64 bits), Windows 8 (64 bits), Windows 8.1 (64 bits) and Windows 10 (64 bits)). Off course you are not obliged to select all the supported version, you can select only the ones you have currently deployed

imageimageimage

  • Then edit the Programs tab to use the clean up script (available here https://docs.microsoft.com/en-us/MicrosoftTeams/scripts/powershell-script-teams-deployment-clean-up) when uninstalling Teams. This is required because uninstalling Teams does not clean up user data and this will block new installation. The Uninstall program field value must be replaced with powershell.exe -ExecutionPolicy Bypass -File .\uninstall_teams.ps1 to run the clean up script (off course the script must have been saved in the same location than the MSI package you have imported to get it packaged and deployed)

You will need to update a little bit the clean up script to also run the uninstall command for the MSI package and clean all user profiles. The updated code will be like this

$TeamsPath = [System.IO.Path]::Combine($env:LOCALAPPDATA, ‘Microsoft’, ‘Teams’)
$TeamsUpdateExePath = [System.IO.Path]::Combine($env:LOCALAPPDATA, ‘Microsoft’, ‘Teams’, ‘Update.exe’)
$OSArchitecture = (Get-WmiObject Win32_OperatingSystem).OSArchitecture
$localprofiles = Get-ChildItem -Path "C:\Users"
Try
{
    If ([System.IO.File]::Exists($TeamsUpdateExePath)) {
        Write-Host "Uninstalling Teams process"

        # Uninstall app
        $proc = Start-Process $TeamsUpdateExePath "-uninstall -s" -PassThru
        $proc.WaitForExit()
    }
    Write-Host "Deleting Teams directory for all user profiles"
    Get-ChildItem ‘HKLM:\Software\Microsoft\Windows NT\CurrentVersion\ProfileList’ | ForEach-Object {$profilePath = $_.GetValue(‘ProfileImagePath’)
    Remove-Item –path "$profilePath\AppData\Local\Microsoft\Teams" -recurse}
   
    If ($OSArchitecture -eq "64-bit")
    {
        msiexec /passive /x Teams_windows_x64_1.1.00.5966.msi
     }
    Else
    {
        msiexec /passive /x Teams_windows_x86_1.1.00.5966.msi
    }
}
Catch
{
    Write-Output "Uninstall failed with exception $_.exception.message"
    exit /b 1
}

image

  • Add the other MSI package to the SCCM application package, edit the deployment to define the requirements and the uninstall program as previously
  • Then you can deploy the SCCM package to your SCCM collection(s)

 

Client Side

  • Once deployed and available, the Teams package is now available for install in the SCCM Software Center

image

  • This will install Teams installer in the Program Files (x86)\Teams Installer for the 64 bits version and Program Files\Teams Installer for the 32 bits version

image

  • When a user log on after the installation, the installer will launched and Teams will be installed for the user thanks to the registry key TeamsMachineInstaller located in HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Run for the 32 bits version and HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run for the 64 bits version

imageimageimage 

NOTE If Teams is already installed using another method, it will not be detected as already installed. You can install it again using the Software Center if you want.

image