Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save talkingmoose/a16ca849416ce5ce89316bacd75fc91a to your computer and use it in GitHub Desktop.
Save talkingmoose/a16ca849416ce5ce89316bacd75fc91a to your computer and use it in GitHub Desktop.
**Download the latest version of this script from: https://gist.github.com/b6637160b65b751824943ede022daa17 .** Downloads and installs the latest available Microsoft product specified directly on the client. This avoids having to manually download and store an up-to-date installer on a distribution server every month.
#!/bin/bash
# enter the Microsoft fwlink (permalink) for the product
linkID="830196" # AutoUpdate SKUless download
# 525133 - Office 2016 for Mac SKUless download
# 525134 - Word SKUless download
# 525135 - Excel SKUless download
# 525136 - PowerPoint SKUless download
# 525137 - Outlook SKUless download
# 820886 - OneNote SKUless download
# 823060 - OneDrive SKUless download
# 830196 - AutoUpdate SKUless download
# 800050 - SharePoint Plugin SKUless download
# 832978 - Skype for Business SKUless download
# if using Jamf Pro, consider replacing the linkID value with "$4" and entering the ID as a script parameter
# change directory to /private/tmp to make this the working directory
cd /private/tmp/
# this is the full fwlink URL
url="https://go.microsoft.com/fwlink/?linkid=$linkID"
# download the installer package and get the file name
fileName=$( /usr/bin/curl -JLO "$url" | /usr/bin/awk -F "'" '{ print $2 }' )
# install the package
/usr/sbin/installer -pkg $fileName -target /
# remove the installer package when done
/bin/rm -f "$fileName"
exit 0

Comments are disabled for this gist.