tis-microsoft-teams-appdata icon

Microsoft Teams

Silent install package for Microsoft Teams

1.7.0.1864-67
Media
Messaging
Office
Media
Messaging
Office

package           : tis-microsoft-teams-appdata
version           : 1.7.0.1864-67
architecture      : x86
section           : base
priority          : optional
name              : Microsoft Teams
categories        : Media,Messaging,Office
maintainer        : WAPT Team,Tranquil IT,Jimmy PELÉ,Gaëtan SEGAT
description       : Microsoft Teams Machine-Wide Installation (Per-User Installation) - Microsoft Teams, also referred to as simply Teams, is a unified communication and collaboration platform that combines persistent workplace chat, video meetings, file storage (including collaboration on files)
depends           : 
conflicts         : tis-microsoft-teams
maturity          : PROD
locale            : all
target_os         : windows
min_wapt_version  : 2.0
sources           : https://docs.microsoft.com/microsoftteams/msi-deployment
installed_size    : 
impacted_process  : Teams
description_fr    : Microsoft Teams, aussi simplement appelé Teams, est une plate-forme de communication et de collaboration unifiée qui combine le chat, les réunions vidéo, le stockage de fichiers (comprend la collaboration sur les fichiers)
description_pl    : Microsoft Teams Machine-Wide Installation (Per-User Installation) - Microsoft Teams, określany również jako po prostu Teams, to platforma zunifikowanej komunikacji i współpracy, która łączy w sobie czat w miejscu pracy, spotkania wideo, przechowywanie plików (w tym współpracę nad plikami)
description_de    : Microsoft Teams Rechnerweite Installation (Pro-Benutzer-Installation) - Microsoft Teams, auch einfach Teams genannt, ist eine einheitliche Kommunikations- und Kollaborationsplattform, die dauerhafte Chats am Arbeitsplatz, Videokonferenzen, Dateispeicherung (einschließlich der Zusammenarbeit an Dateien)
description_es    : Instalación de Microsoft Teams en todo el equipo (instalación por usuario) - Microsoft Teams, también denominado simplemente Teams, es una plataforma de comunicación y colaboración unificada que combina el chat persistente en el lugar de trabajo, las reuniones de vídeo, el almacenamiento de archivos (incluida la colaboración en archivos)
description_pt    : Instalação Microsoft Teams Machine-Wide (Instalação por utilizador) - Microsoft Teams, também referida como simplesmente Equipas, é uma plataforma unificada de comunicação e colaboração que combina chat persistente no local de trabalho, reuniões em vídeo, armazenamento de ficheiros (incluindo colaboração em ficheiros)
description_it    : Microsoft Teams Machine-Wide Installation (Per-User Installation) - Microsoft Teams, indicato anche come semplicemente Teams, è una piattaforma di comunicazione e collaborazione unificata che combina chat persistenti sul posto di lavoro, riunioni video, archiviazione di file (compresa la collaborazione su file) e un'ampia gamma di servizi
description_nl    : Microsoft Teams Machine-Wide Installatie (Per-User Installatie) - Microsoft Teams, ook wel gewoon Teams genoemd, is een platform voor verenigde communicatie en samenwerking dat permanente chat op de werkplek, videovergaderingen, bestandsopslag (inclusief samenwerking aan bestanden) combineert
description_ru    : Microsoft Teams Machine-Wide Installation (Per-User Installation) - Microsoft Teams, также называемая просто Teams, представляет собой платформу унифицированных коммуникаций и совместной работы, объединяющую постоянный чат на рабочем месте, видеовстречи, хранение файлов (включая совместную работу над файлами)
audit_schedule    : 
editor            : Microsoft
keywords          : microsoft,teams,team,communication,collaboration,chat,video,meetings
licence           : Proprietary
homepage          : https://www.microsoft.com/microsoft-365/microsoft-teams/group-chat-software
package_uuid      : 04e334f4-5879-4bf9-94b6-aca4e12358cc
valid_from        : 
valid_until       : 
forced_install_on : 
changelog         : https://support.office.com/article/what-s-new-in-microsoft-teams-d7092a6d-c896-424c-b362-a472d5f105de
min_os_version    : 6.1
max_os_version    : 
icon_sha256sum    : c6e1224de3bf5ed2d252f9cee788480febfe2993b02cf91cf3258e7306274674
signer            : Tranquil IT
signer_fingerprint: 8c5127a75392be9cc9afd0dbae1222a673072c308c14d88ab246e23832e8c6bb
signature         : NdpKkdcx60nGp/XwimvtBe2jhwyyvTC0OGn8mTC9D3Gt5uMb/yWjeFQQFA5734A025G9GCRtiXfTS7l807MR1tCrkKiMPx5+McLhDi6uixo67bbOG8vQ50o1bgzBzq/cg79gXHpnD0f3kFmop6Wn/KQnkeE7twZskd7dwKnN6OY4KplWSXUJZ8CMWFMAD1PseE5CTsXgX9F5Dvop2LOdfIfB1iASE4D03nNWnaHlLZcc6csQ8NMzJwSomq4fnGKNeWplOhSD6rTe+NecVL6RLiWx4mQq9/QkFpSEeSCPNwRJQuOGXPr03jqC5jLEyEIZu9jL2qczwZvwhvzA6D3zKQ==
signature_date    : 2024-02-11T12:02:16.199483
signed_attributes : package,version,architecture,section,priority,name,categories,maintainer,description,depends,conflicts,maturity,locale,target_os,min_wapt_version,sources,installed_size,impacted_process,description_fr,description_pl,description_de,description_es,description_pt,description_it,description_nl,description_ru,audit_schedule,editor,keywords,licence,homepage,package_uuid,valid_from,valid_until,forced_install_on,changelog,min_os_version,max_os_version,icon_sha256sum,signer,signer_fingerprint,signature_date,signed_attributes

# -*- coding: utf-8 -*-
from setuphelpers import *
import json
import time
import tempfile
import codecs

# {731F6BAA-A986-45A4-8936-7C3AAAAA760B}      Teams Machine-Wide Installer        1.3.0.12058         MsiExec.exe /I{731F6BAA-A986-45A4-8936-7C3AAAAA760B}
# Installation procedure: https://docs.microsoft.com/fr-fr/microsoftteams/teams-for-vdi#install-or-update-the-teams-desktop-app-on-vdi

# Defining variables
bin_name_string = "Teams_windows_%s_x64.msi"
bin_name_temp = "Teams_windows_x64.msi"

silent_args = 'OPTIONS="noAutoStart=true" ALLUSERS=1'  # OPTIONS="noAutoStart=true" ALLUSER=1 ALLUSERS=1
# silent_args = 'ALLUSER=1' #OPTIONS="noAutoStart=true" ALLUSER=1 ALLUSERS=1
app_name = "Microsoft Teams"
app_name_short = "Teams"
app_dir = makepath(programfiles32, "Microsoft", "Teams")
app_path = makepath(app_dir, "current", "Teams.exe")
# sys_json_setup = makepath(app_dir,'setup.json')
# json_setup_content =  json.loads('{"noAutoStart":true,"--exeName":"Teams.exe"}')

TASK_TEMPLATE = r"""\
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Date>%(created_on)s</Date>
    <Author>WAPT</Author>
  </RegistrationInfo>
  <Triggers>
    <TimeTrigger>
      <StartBoundary>%(run_on)s</StartBoundary>
      <EndBoundary>%(expired_on)s</EndBoundary>
      <ExecutionTimeLimit>PT1H</ExecutionTimeLimit>
      <Enabled>true</Enabled>
    </TimeTrigger>
  </Triggers>
  <Settings>
    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
    <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
    <AllowHardTerminate>true</AllowHardTerminate>
    <StartWhenAvailable>false</StartWhenAvailable>
    <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
    <IdleSettings>
      <StopOnIdleEnd>true</StopOnIdleEnd>
      <RestartOnIdle>false</RestartOnIdle>
    </IdleSettings>
    <AllowStartOnDemand>true</AllowStartOnDemand>
    <Enabled>true</Enabled>
    <Hidden>false</Hidden>
    <RunOnlyIfIdle>false</RunOnlyIfIdle>
    <WakeToRun>false</WakeToRun>
    <ExecutionTimeLimit>PT1H</ExecutionTimeLimit>
    <DeleteExpiredTaskAfter>PT0S</DeleteExpiredTaskAfter>
    <Priority>7</Priority>
  </Settings>
  <Actions Context="Author">
    <Exec>
      <Command>%(cmd)s</Command>
      <Arguments>%(parameters)s</Arguments>
    </Exec>
  </Actions>
</Task>
"""


def create_onetime_task_user(name, cmd, parameters=None, delay_minutes=2, max_runtime=10, retry_count=3, retry_delay_minutes=1):
    """creates a one time Windows scheduled task and activate it."""
    run_time = time.localtime(time.time() + delay_minutes * 60)
    # task

    if windows_version(2) <= Version("5.2", 2):
        # for win XP
        current_account = get_current_user()
        # windows xp doesn't support one time startup task /Z nor /F
        hour_min = time.strftime("%H:%M:%S", run_time)
        run_notfatal('schtasks /Delete /TN "%s" /F' % name)
        return run('schtasks /Create /SC ONCE /TN "%s" /TR  "%s %s" /ST %s /RU %s' % (name, cmd, parameters, hour_min, current_account))
    else:
        current_account = get_current_user()
        xmlfile = tempfile.mktemp(".xml")
        created_on = time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime(time.time()))
        run_on = time.strftime("%Y-%m-%dT%H:%M:%S", run_time)
        expired_on = time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime(time.time() + 90 * 24 * 3600))
        codecs.open(xmlfile, "wb", encoding="utf8").write(TASK_TEMPLATE % locals())
        result = run('schtasks /Create /F /TN "%s" /XML "%s"' % (name, xmlfile))
        if isfile(xmlfile):
            remove_file(xmlfile)
        return result


def install():
    # Initializing variables
    package_version = control.version.split("-")[0]
    bin_name = bin_name_string % package_version
    app_name = control.name

    # Uninstalling older versions if found
    for uninstall in installed_softwares(name=app_name_short):
        if Version(uninstall["version"]) < Version(package_version):
            print("Older %s version found (%s)" % (app_name, uninstall["version"]))
            print("Removing: %s (%s)" % (uninstall["name"], uninstall["version"]))
            run_notfatal(uninstall_cmd(uninstall["key"]))
            time.sleep(15)

    # Installing the package system wide
    print("Installing: %s" % bin_name)
    install_msi_if_needed(bin_name, properties=silent_args, min_version=package_version, accept_returncodes=[0, 3010, 1605, 1614, 1641], timeout=900)

    # Removing shortcuts
    remove_desktop_shortcut(app_name)


def session_setup():
    # Initializing variables
    user_conf_dir = makepath(application_data, "Microsoft", "Teams")
    json_config = makepath(user_conf_dir, "desktop-config.json")
    json_settings = makepath(user_conf_dir, "settings.json")

    # Cleaning up desktop-config.json once
    if registry_readstring(HKEY_CURRENT_USER, r"Software\WAPT\Teams", "CleanDeskConfOnce") != "Done":
        if isfile(json_config):
            remove_file(json_config)
        if isfile(json_settings):
            remove_file(json_settings)
        print("Cleaning up Teams Desktop Conf Once")
        registry_set(HKEY_CURRENT_USER, r"Software\WAPT\Teams", "CleanDeskConfOnce", "Done")
    if not isrunning("Teams.exe"):
        if force:  # registry_readstring(HKEY_CURRENT_USER,r'Software\WAPT\Teams','CleanDeskConfOnce') != 'Done' or
            if isdir(user_conf_dir):
                remove_tree(user_conf_dir)

    # No longer Prefill UPN
    registry_set(HKEY_CURRENT_USER, r"Software\Microsoft\Office\Teams", "SkipUpnPrefill", 1, type=REG_DWORD)

    # Define user settings (procedure: https://techcommunity.microsoft.com/t5/microsoft-teams/how-to-disable-check-for-updates-in-microsoft-teams/m-p/54644)
    print("Setting up user settings")
    if not isdir(user_conf_dir):
        mkdirs(user_conf_dir)

    # desktop-config.json
    if isfile(json_config):
        json_config_content = load_json(json_config)
    else:
        json_config_content = json.loads('{"appPreferenceSettings":{}}')
        # json_config_content = json.load({})

    json_config_content["appPreferenceSettings"]["openAtLogin"] = True
    json_config_content["appPreferenceSettings"]["openAsHidden"] = True
    json_config_content["appPreferenceSettings"]["runningOnClose"] = True
    json_config_content["appPreferenceSettings"]["registerAsIMProvider"] = True  # Teams comme chat Office
    json_config_content["isForeground"] = True
    json_config_content["wamFallbackInProgress"] = False  # False aussi sur PC Agesys
    json_config_content["disableWarningOnOpenKeyRegistered"] = True
    json_config_content["isAppFirstRun"] = False

    write_json(json_config, json_config_content)

    # settings.json
    if isfile(json_settings):
        json_settings_content = load_json(json_settings)
    else:
        json_settings_content = json.loads('{"baseSettings":{},"initializedSettings":{},"preauthSettings":{"samplingRules":{}}}')
        # json_settings_content = json.load({})

    # Update part
    json_settings_content["baseSettings"]["enableBlockSilentUpdate"] = True
    json_settings_content["baseSettings"]["disableAllUsersAutoUpdate"] = True
    json_settings_content["baseSettings"]["enableUnAuthUpdates"] = False
    # json_settings_content['initializedSettings']['disableAllUsersAutoUpdate'] = True
    # json_settings_content['preauthSettings']['disableAllUsersAutoUpdate'] = True
    # json_settings_content['preauthSettings']['samplingRules']['updateNotificationEnabled'] = False
    # Telemetry part
    json_settings_content["baseSettings"]["enableAdalMacTelemetryV2"] = False
    json_settings_content["baseSettings"]["enableAdalWinTelemetry"] = False
    json_settings_content["baseSettings"]["proplusAdditionalTelemetryEnabled"] = False
    json_settings_content["baseSettings"]["regionInTelemetryEnabled"] = False
    json_settings_content["baseSettings"]["tenantRegionInTelemetryEnabled"] = False
    # json_settings_content['baseSettings']['enableRegisterProtocolToRoot'] = False
    # json_settings_content['initializedSettings']['tenantRegionInTelemetryEnabled'] = False
    # json_settings_content['preauthSettings']['tenantRegionInTelemetryEnabled'] = False
    # json_settings_content['preauthSettings']['samplingRules']['tenantRegionInTelemetryEnabled'] = False
    # Other part
    # json_settings_content['preauthSettings']['registerAddinOnMeetingPolicySettingsSync'] = False

    write_json(json_settings, json_settings_content)

    # Removing user shortcut once
    # if registry_readstring(HKEY_CURRENT_USER, r"Software\WAPT\Teams", "RemoveUserIconOnce") != "Done":
    #     print("Removing Teams Desktop Icon")
    #     create_onetime_task_user(
    #         "RemoveTeamsUserDesktopsShortcut_%s" % get_current_user(),
    #         "cmd",
    #         r'/C del /f "%USERPROFILE%\Desktop\Microsoft Teams.lnk"',
    #         delay_minutes=5,
    #     )
    #     remove_user_desktop_shortcut(app_name)
    #     registry_set(HKEY_CURRENT_USER, r"Software\WAPT\Teams", "RemoveUserIconOnce", "Done")


def uninstall():
    # Initializing variables
    processes_to_kill = control.impacted_process.strip().replace(" ", "").split(",")
    count = 30  # 30x10=300sec maximum waiting

    # Uninstalling the package
    for uninstall in installed_softwares(name=app_name_short):
        killalltasks(processes_to_kill)
        print("Uninstalling: %s" % uninstall["name"])
        run_notfatal(uninstall_cmd(uninstall["key"]))

    while installed_softwares(name=app_name_short):
        count -= 1
        if count == 0:
            error("Unable to uninstall: %s" % app_name)
        time.sleep(10)

    # Removing remaining files
    if isdir(app_dir):
        killalltasks(processes_to_kill)
        remove_tree(app_dir)


def load_json(json_filename):
    with open(json_filename) as json_file:
        data = json.load(json_file)
    return data


def write_json(json_filename, data):
    with open(json_filename, "w") as outfile:
        json.dump(data, outfile, sort_keys=True, indent=4, default=str)

# -*- coding: utf-8 -*-
from setuphelpers import *
import os
import requests

bin_name_string = "Teams_windows_%s_x64.msi"
download_url = "https://teams.microsoft.com/downloads/desktopurl?env=production&plat=windows&arch=x64&managedInstaller=true&download=true"


def update_package():
    # Declaring local variables
    result = False
    proxies = get_proxies()
    if not proxies:
        proxies = get_proxies_from_wapt_console()
    app_name = control.name
    url = download_url
    # url = 'http://aka.ms/teams64bitmsi'

    # Getting latest version from official sources
    print("URL used is: %s" % url)
    version = requests.head(url, proxies=proxies).headers["Location"].split("/")[-2].replace("00", "0")
    latest_bin = bin_name_string % version

    print("Latest %s version is: %s" % (app_name, version))
    print("Download URL is: %s" % download_url)

    # Downloading latest binaries
    if not isfile(latest_bin):
        print("Downloading: %s" % latest_bin)
        wget(download_url, latest_bin, proxies=proxies)

        # Checking version from file
        version_from_file = get_version_from_binary(latest_bin)
        if Version(version) != Version(version_from_file) and version_from_file != "":
            print("Changing version to the version number of the binary (from: %s to: %s)" % (version, version_from_file))
            os.rename(latest_bin, bin_name_string % version_from_file)
            version = version_from_file
        else:
            print("Binary file version corresponds to online version")

    # Changing version of the package
    if Version(version) > Version(control.get_software_version()):
        print("Software version updated (from: %s to: %s)" % (control.get_software_version(), Version(version)))
        result = True
    else:
        print("Software version up-to-date (%s)" % Version(version))
    control.version = "%s-%s" % (Version(version), control.version.split("-", 1)[-1])
    # control.set_software_version(version)
    control.save_control_to_wapt()

    # Deleting outdated binaries
    remove_outdated_binaries(version)

    # Validating or not update-package-sources
    return result

48c99d0efce74feaf3a17e72438263ba5bb67b9f1901c81b5f93cb251f22a05e : setup.py
62d4ce71ed58bd3169f0c11dc21262d983c16e481fbc448b9b53c8ee555e6365 : update_package.py
3b6aa40a26e11d486d079a216439cad9ff4238da33be962bedf262ad8ebeac76 : Teams_windows_1.7.0.1864_x64.msi
c6e1224de3bf5ed2d252f9cee788480febfe2993b02cf91cf3258e7306274674 : WAPT/icon.png
a5a97261381e1d0ad46ee15916abec9c2631d0201f5cc50ceb0197a165a0bbbf : WAPT/certificate.crt
7b882a8a63e42cf6a20ef73390bb08d67cfd295d70fd3596d21f05626f658354 : WAPT/changelog.txt
3b7fe5683cf97efd04e29cae745dad9c5bc86b54f941327ab59261f42a546319 : luti.json
9e84bbb53934267f72a098545c2141294727b743f832eb2dc5643d17a800421a : WAPT/control