SCRIPT | Install-Microsoft-Teams-Latest

Install Microsoft Teams

Summary

This script will install the latest version of Microsoft Teams.


Script Content

#!/bin/zsh
cd "/Library/Application Support/JAMF/tmp"

# Obtain URL for PKG
teamsurl="https://teams.microsoft.com/downloads/DesktopUrl?env=production&plat=osx&arch=64"

# Update variables. These shouldn't need to change for each update
pkgname="Teams_osx.pkg"
pkglink=$(curl -s "$teamsurl")
apptoupdaterunningname="Microsoft Teams"

# Download PKG
curl -L -o "$pkgname" "$pkglink"

sleep 10

# Kill the app if it is running
killall -Kill "$apptoupdaterunningname"

# Install PKG
sudo installer -pkg $pkgname -target /

# Remove the downloaded PKG
rm $pkgname

# Clear out the used variables
unset teamsurl
unset pkgname
unset pkglink
unset apptoupdaterunningname
exit 0

Concluding Comments

Microsoft Teams is pretty much an essential application for any enterprise user these days, this script allow you to know the latest version is always being deployed.