Microsoft Application Installation and Updates

dnorman
New Contributor III

I've created this script with some bits from other scripts I've seen here.
What I've tried to do is create one script that can use parameters for multiple apps. Use cases are: installing a single app, installing multiple or all apps, installing autoupdate if the user installs an app.

What I'd like to do is pass in multiple parameters with all the desired apps and install Microsoft autoupdate if it's not already installed. At the moment I'm considering using a smart group to deploy autoupdate which can work too but I'm not sure that's the best approach since there's a gap between when the user installs the app, smart group updates, and when autoupdate is then pushed.

I'm still new to scripting so I'm sure there are things that can be improved here.

My plan for updates is to use the configuration profile for Microsoft AutoUpdate.

If you have any suggestions I would very much appreciate it.

#!/bin/sh

app=""                #   [ excel | outlook | powerpoint | word | rdp | autoupdate ]
exceldl="https://go.microsoft.com/fwlink/?linkid=525135"
outlookdl="https://go.microsoft.com/fwlink/?linkid=525137"
powerpointdl="https://go.microsoft.com/fwlink/?linkid=525136"
worddl="https://go.microsoft.com/fwlink/?linkid=525134"
rdpdl="https://go.microsoft.com/fwlink/?linkid=868963"
autoupdatedl="https://go.microsoft.com/fwlink/?linkid=830196"

[ "$4" != "" ] && [ "$app" == "" ] && app=$4

pkgfile="microsoft${app}.pkg"
logfile="/Library/Logs/microsoft${app}installscript.log"

url="${app}dl"

/bin/echo "--" >> ${logfile}
/bin/echo "`date`: Downloading latest version of ${app}." >> ${logfile}
/usr/bin/curl -L -s -o /private/var/tmp/${pkgfile} ${!url}
/bin/echo "`date`: Installing..." >> ${logfile}
/usr/sbin/installer -pkg /private/var/tmp/${pkgfile} -target /
/bin/sleep 10
/bin/echo "`date`: Deleting package file." >> ${logfile}
/bin/rm /private/var/tmp/"${pkgfile}"

exit 0
9 REPLIES 9

Kallendal
New Contributor III

Question: is this downloading 0365 version of Office (outside of the App Store)? Or is it downloading the equal of MS Office for Mac 2019?

Thanks

dnorman
New Contributor III

@Kallendal I'm using the standalone Office365 apps directly from Microsoft (not through the app store). Links can be found here: https://macadmins.software/
That website lists other versions as well.

sdagley
Esteemed Contributor II

@dnorman It looks like you're planning to download the individual installers for each app. That's going to result in an excessive amount of data being downloaded if you're installing more than 1 of the main apps.

Take a look at @pbowden's Deploying Office 365 ProPlus w/ Jamf Pro video where he describes how you can use a .plist to have the full Office 365 BusinessPro Suite Installer (https://go.microsoft.com/fwlink/?linkid=2009112) only install selected apps. (You can do something similar with a choices .xml file, but creating the .plist on the fly is easier). You can incorporate the mechanism described in the video with your script and get something that runs faster, and with less data downloaded.

dnorman
New Contributor III

Thanks @sdagley I didn't know about this. I tested it with a script and it works well. I think we'll use this method going forward.

snowfox
Contributor III

Below is a plist file you can import into a Jamf config under Applications & Custom settings. Because the Office apps are now sandboxed you can't edit the installer.pkg any more. So you have to use something like below to select what gets installed. I'm using this for Office 2019 at the moment in a lab.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>DefaultsToLocalOpenSave</key>
    <true/>
    <key>DiagnosticDataTypePreference</key>
    <string>ZeroDiagnosticData</string>
    <key>HasUserSeenEnterpriseFREDialog</key>
    <true/>
    <key>InstallAutoUpdate</key>
    <false/>
    <key>InstallExcel</key>
    <true/>
    <key>InstallOneDrive</key>
    <false/>
    <key>InstallOneNote</key>
    <true/>
    <key>InstallOutlook</key>
    <false/>
    <key>InstallPowerPoint</key>
    <true/>
    <key>InstallTeams</key>
    <false/>
    <key>InstallWord</key>
    <true/>
    <key>OfficeAutoSignIn</key>
    <true/>
    <key>SendAllTelemetryEnabled</key>
    <false/>
    <key>ShowDocStageOnLaunch</key>
    <true/>
    <key>ShowWhatsNewOnLaunch</key>
    <false/>
    <key>TermsAccepted1809</key>
    <true/>
</dict>
</plist>

sdagley
Esteemed Contributor II

@snowfox You should mention that the preference domain to apply that plist to is com.microsoft.office

Rohitds14
New Contributor III

check Pbowden script for managing microsoft update in github
https://github.com/pbowden-msft/msupdatehelper

snowfox
Contributor III

@sdagley Whoops, my bad. Thanks. It added automatically when I imported the file. That was the name of the plist file. If the plist is incorrectly named it will import the wrong domain name and must be edited in the text field. com.microsoft.office.plist is what you should name your file before import.

jlombardo
Contributor

Sort of off topic, but is there a place I can figure out how to script a download of Mimecast for Outlook from the Windows store for Mac? The link above I can only locate information about Microsoft Office downloads.