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
<<ABOUT_THIS_SCRIPT
-----------------------------------------------------------------------
Written by:William Smith
Professional Services Engineer
Jamf
[email protected]
https://gist.github.com/talkingmoose/a16ca849416ce5ce89316bacd75fc91a
Originally posted: November 19, 2017
Purpose: 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.
Instructions: Update the linkID value to one of the corresponding
Microsoft products in the list and run the script with elevated
privileges. If using Jamf Pro, consider replacing the linkID value
with "$4" and entering the ID as a script parameter in a policy.
Except where otherwise noted, this work is licensed under
http://creativecommons.org/licenses/by/4.0/
"You say goodbye and I say exit 0."
-----------------------------------------------------------------------
ABOUT_THIS_SCRIPT
# enter the Microsoft fwlink (permalink) product ID
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
# this is the full fwlink URL
url="https://go.microsoft.com/fwlink/?linkid=$linkID"
# change directory to /private/tmp to make this the working directory
cd /private/tmp/
# 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.