Link to home
Create AccountLog in
Avatar of Pkafkas
Pkafkas

asked on

I am trying to deploy Microsoft Teams enterprise wide, for mass installation on different computers.

We use Zenworks and it works very well with .msi files and .exe files and I can add scripts and regitry hacks to an installation bundle.

If I try to install Teams, it installs to user accounts on a computer that have never had Teams installed before.  But for users that have installed teams it does not install.  How can I force teams to install anyway on a user account through an installation package on the computer?

I guess knowing what the problem sis key first.  Then finding the solution for the problem.

https://sysmansquad.com/2021/01/26/trigger-teams-installer-for-user-after-machine-wide-installer/

https://xenit.se/tech-blog/why-does-teams-not-install-for-my-users/
Avatar of Bembi
Bembi
Flag of Germany image

My first question would be, why do you wan tto install it if it is already installed...
Maybe more a patching question?
Or you may have to create a removal package first. 
Avatar of Pkafkas
Pkafkas

ASKER

Well, we want a standardized installation for all computers.  It will make things easier to trouble-shoot later.
Yea, I can imagine.
As I said, one option is to uninstall and to reinstall.
The other option is to use GPOs for the configuration.
The third option would be to splitt is up into a basic installation and a customizing installion.
For the clients, which already have Teams installed, you apply only the customization package.

Im not aware about the capability of Zenworks, but most of the installers and distribution tools are capable in that way. 

Avatar of Pkafkas

ASKER

What does this code do?  It is from: Trigger Teams Installer for User After Machine Wide Installer - Systems Management Squad (sysmansquad.com) 


<#
.SYNOPSIS
    Launch the Teams install as the logged in user via a scheduled task
.DESCRIPTION
    This script will create a scheduled task if one is not found which is used to
    install Microsoft Teams as the logged in user. This scheduled task executes
    the Teams.exe found in %ProgramFiles% so that a user can start using Teams
    shortly after the Machine Wide installer completes instead of having to 
    log off and back on.
.NOTES
    Generally used as a script that runs after a Teams Machine Wide Installer completes
#>
if (!(Get-ScheduledTask -TaskName 'Teams User Install - Post Machine Wide Install' -ErrorAction SilentlyContinue)) {
    switch ([System.Environment]::Is64BitOperatingSystem) {
        $true {
            [string]$TeamsMachineInstaller = Get-ItemPropertyValue -Path registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Run\ -Name TeamsMachineInstaller -ErrorAction Stop
            [string]$Exe = $TeamsMachineInstaller.Substring(0, $TeamsMachineInstaller.IndexOf('.exe') + 4).Trim() -Replace "C:\\Program Files\\", "${env:ProgramFiles(x86)}\"
    
        }
        $false {
            [string]$TeamsMachineInstaller = Get-ItemPropertyValue -Path registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\ -Name TeamsMachineInstaller -ErrorAction Stop
            [string]$Exe = $TeamsMachineInstaller.Substring(0, $TeamsMachineInstaller.IndexOf('.exe') + 4).Trim()
        }
    }
    [string]$InstallerArgs = $TeamsMachineInstaller.Substring($Exe.Length, $TeamsMachineInstaller.Length - $exe.Length).Trim()
    $newScheduledTaskSplat = @{
        Action      = New-ScheduledTaskAction -Execute $Exe -Argument $InstallerArgs
        Description = 'Start the Teams installer for the currently logged on user after a Teams Machine Wide install'
        Settings    = New-ScheduledTaskSettingsSet -Compatibility Vista -AllowStartIfOnBatteries -MultipleInstances IgnoreNew -ExecutionTimeLimit (New-TimeSpan -Hours 1)
        Trigger     = New-ScheduledTaskTrigger -At ($Start = (Get-Date).AddSeconds(5)) -Once
        Principal   = New-ScheduledTaskPrincipal -GroupId 'S-1-5-32-545' -RunLevel Limited
    }
    
    $ScheduledTask = New-ScheduledTask @newScheduledTaskSplat
    $ScheduledTask.Settings.DeleteExpiredTaskAfter = "PT0S"
    $ScheduledTask.Triggers[0].StartBoundary = $Start.ToString("yyyy-MM-dd'T'HH:mm:ss")
    $ScheduledTask.Triggers[0].EndBoundary = $Start.AddMinutes(10).ToString('s')
    
    Register-ScheduledTask -InputObject $ScheduledTask -TaskName 'Teams User Install - Post Machine Wide Install'
}

Open in new window

Its written in the description.
    This script will create a scheduled task if one is not found which is used to
    install Microsoft Teams as the logged in user. This scheduled task executes
    the Teams.exe found in %ProgramFiles% so that a user can start using Teams
    shortly after the Machine Wide installer completes instead of having to
    log off and back on
.

At the end, it avoiding the need of logging of and login on again for the user. 
Avatar of Pkafkas

ASKER

This looks promising, But the below did not work for me, if Teams was already installed under my username.  How can I remove teams (execute a script) before the installation is applied?

Getting Started with Microsoft Teams Enterprise Deployment, Part 1 - Microsoft Tech Community (https://techcommunity.microsoft.com/t5/healthcare-and-life-sciences/getting-started-with-microsoft-teams-enterprise-deployment-part/ba-p/714584_

Install Teams using Microsoft Endpoint Configuration Manager - Microsoft Teams | Microsoft Docs (https://docs.microsoft.com/en-us/microsoftteams/msi-deployment)

Clean up and redeployment procedure

If a user uninstalls Teams from their user profile, the MSI installer will track that the user has uninstalled the Teams app and no longer install Teams for that user profile. To redeploy Teams for this user on a particular computer where it was uninstalled, do the following:

  1. Uninstall the Teams app installed for every user profile. For more information, see Uninstall Microsoft Teams.
  2. Delete the directory recursively under %localappdata%\Microsoft\Teams\.
  3. Delete the HKEY_CURRENT_USER\Software\Microsoft\Office\Teams\PreventInstallationFromMsi registry value.
  4. Redeploy the MSI package to that particular computer.

   
ASKER CERTIFIED SOLUTION
Avatar of Bembi
Bembi
Flag of Germany image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer