Install custom MS Teams background images

LaMantia
New Contributor III

Hi all, I did not see anything like what I needed so I created one. Below is a script to copy image files to a users local directory. It works fine, very basic, but I'd like to combine the two if statements and work out an exit code if the source files are not present. If anyone is bored out there???? : )

#!/bin/sh

#Created by Brian LaMantia 6/1/2020
#Move FIS background images from /private/tmp to the current users Uploads folder in Teams. 
#Run after the images are deployed to the tmp folder then displays a message to the user. 
#If the package fails, do not display a message. 
#If you make this better, post a copy for me!  

#get current user
currentUser=$(/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }')

#Check if the images package was installed
sourceFiles=/private/tmp/Teams

#Check if Teams uploads folder exists
teamsPath=/Users/"$currentUser"/Library/Application Support/Microsoft/Teams/Backgrounds/Uploads/

#jamfhelper path
jamfHelper=/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper

#set icon
icon=/Applications/Microsoft Teams.app/Contents/Resources/icon.icns

if  [ ! -d "$sourceFiles" ]; then
    echo "Missing source files, script will fail, did not display messsage."
else
    #Tell the user that the backgrounds are available.
    "$jamfHelper" -windowType hud -windowPosition ul -title "Your title here" -heading "Microsoft Teams" -description "Check it out! New Teams video backgrounds are available now. We hope you enjoy them!" -icon "$icon" -button1 "OK" &
fi

#if teamsPath exists copy background images to the Uploads folder and set permissions, else quit
if  [ -d "$teamsPath" ]; then
    cp /private/tmp/Teams/*.* /Users/"$currentUser"/Library/Application Support/Microsoft/Teams/Backgrounds/Uploads
    chown "$currentUser":wheel /Users/"$currentUser"/Library/Application Support/Microsoft/Teams/Backgrounds/Uploads/*.*
else
    echo "Path is missing, creating required folders"
    mkdir -p /Users/"$currentUser"/Library/Application Support/Microsoft/Teams/Backgrounds/Uploads
    cp /private/tmp/Teams/*.* /Users/"$currentUser"/Library/Application Support/Microsoft/Teams/Backgrounds/Uploads
    chown "$currentUser":wheel /Users/"$currentUser"/Library/Application Support/Microsoft/Teams/Backgrounds/Uploads/*.*
fi
5 REPLIES 5

garybidwell
Contributor II

I do this a different way without the need of a script.
I just create a DMG using composer of the Teams background images in the required path location and just use Jamf's FEU & FUT package feature in policies to deploy straight in to each users account.

LaMantia
New Contributor III

@garybidwell Thank you. I've never used that option. I will test that out for sure. Any "gotchas" with using FUE & FUT?

garybidwell
Contributor II

not really, its pretty simple to use as long as you remember it only works on DMG and not PKG. I like to set the permissions within Composer myself just as force of habit making PKG's all the time, but with the DMG FUE & FUT options it make it irrelevant as Jamf does all this automatically as part of the install process.
You just need to set your deployment frequency to "Once per user per computer" to ensure it deploys to every user account on every device.

savriette
New Contributor

How does JAMF know where to put the image for FUE/FUT? Microsoft kind of buried it in /Users/username/Library/Application Support/Microsoft/Teams/Backgrounds/Uploads? I could see doing that for a standard wallpaper, but I'm just not understanding how the FUE/FUT function works.

andrew_nicholas
Valued Contributor

The path dropped into composer essentially becomes a static variable for everything after "/Library/Application Support/Microsoft/Teams/Backgrounds/Uploads". Everything before that is then a blank value that is just iteratively filled in when rolling through user account or language templates and permissions updated accordingly.