Best practices for automating Office 2016 updates?

ABigRock
New Contributor III

I am just wondering how everyone is managing automating Office 2016 updates with Jamf? I know that MAU 4.0 is supposed to have system level settings available but as of right now it is still user level. I have a very large number of dispersed lab computers that do not normally have admins login so I am wondering what would be the best way to go about forcing automatic download and installation of updates. I am sorry if this question has been asked and answered in the past. Thank you in advance for the advice.

1 ACCEPTED SOLUTION

stevewood
Honored Contributor II
Honored Contributor II

@ABigRock at the bottom of Rich's article you will find a .mobileconfig link that you can upload into Casper and use as a Configuration Profile. Set it to Install Automatically and at Computer Level.

Enabling Automatic Download

View solution in original post

64 REPLIES 64

bbot
Contributor

subscribed. My environment also has many people without admin rights. I've been manually pushing out updates (5 packages for each office app).

Brad_G
Contributor II

You're in luck as you can do that now with MAU 3.8.

https://macadmins.software/docs/MAU_38.pdf

ABigRock
New Contributor III

Brad_G, thank you for posting that but if I am not mistaken the "Automatically Download and Install" option is not defaulted for each user and is a user level setting. So while I may set it for the admin account any user that logs into the system would be defaulted to "Automatically check". It is great that it gets past the admin credentials requirement but would you happen to know how to force the settings change for all users? Additionally, I have found that, and I may be wrong, MAU is only checking for updates to Office 2016 applications that the current user has opened so if they have only opened word then that is all that will update. Again thank you for your quick response and I apologize if I am entirely incorrect in my assumptions.

cbrewer
Valued Contributor II

MAU 4.0 will have command line support. This should allow you to build a policy to check for updates and install them. Coming soon.

stevewood
Honored Contributor II
Honored Contributor II

@ABigRock at the bottom of Rich's article you will find a .mobileconfig link that you can upload into Casper and use as a Configuration Profile. Set it to Install Automatically and at Computer Level.

Enabling Automatic Download

ABigRock
New Contributor III

@stevewood Thanks, that is exactly what I was looking for.

neil_martin83
Contributor II

@ABigRock I did a talk on MAU the other week - as well as getting MAU and a config profile out to your Macs, there are a couple of things you need to do when you consider that those running it may not have been the ones who installed in/Office. Full details in the video!

https://youtu.be/lxizq5EZHWM?t=39m58s

You need to make sure the apps are registered (can be added to the profile - either run all the Office apps on a machine and copy out the keys from ~/Library/Preferences/com.microsoft.autoupdate2.plist to your profile or check out the postinstall scripts in the Office installer pkg - you can use those to create the keys on a Mac you don't have Office on).

Also make sure MAU is registered with Launch Services for the current logged in user so it doesn't prompt them the first time it runs for them.

Login script to register MAU with Launch Services (I run this once per user per computer):

#!/bin/sh
loggedInUser=`python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "
");'`

su - "$loggedInUser" -c '/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -R -f -trusted -v "/Library/Application Support/Microsoft/MAU2.0/Microsoft AutoUpdate.app"'
su - "$loggedInUser" -c '/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -R -f -trusted -v "/Library/Application Support/Microsoft/MAU2.0/Microsoft AutoUpdate.app/Contents/MacOS/Microsoft AU Daemon.app"'
su - "$loggedInUser" -c 'defaults delete com.microsoft.autoupdate2 LastUpdate'

exit 0

Kumarasinghe
Valued Contributor

This script will create a LaunchAgent and registers MAU and All Office apps for the autoupdate, otherwise you will have to open each office app once to get it registered with MAU when you install Office via Casper.

You only need to run this script once per computer.

#!/bin/sh
# All Glory and Thanks to Jesus!

#
# Create MAU trust Launch Agent and the Script using scripting method
#

/bin/cat << 'EOF' > "/Library/LaunchAgents/com.myorg.registermau.plist"
<?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>Label</key>
     <string>com.myorg.registermau</string>
     <key>ProgramArguments</key>
     <array>
          <string>/usr/local/bin/RegisterMAU.sh</string>
     </array>
     <key>RunAtLoad</key>
     <true/>
</dict>
</plist>
EOF

/bin/cat << 'EOF' > "/usr/local/bin/RegisterMAU.sh"
#!/bin/sh

###############################################################################################################
#
# Register MAU using a Launch Agent (/Library/LaunchAgents/com.myorg.registermau.plist)
#
###############################################################################################################

###########
# Functions
###########

# Check if com.myorg.MAUtrustDone.plist file exists and if yes don't re-register
checkMAUtrustDone() {
     if [ -f $HOME/Library/Preferences/com.myorg.MAUtrustDone.plist ] ; then
        exit 0
    fi
}

# re-register and create a file called com.myorg.MAUtrustDone.plist
trustMAU() {
if [ -e "/Library/Application Support/Microsoft/MAU2.0/Microsoft AutoUpdate.app" ]; then
     /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -R -f -trusted "/Library/Application Support/Microsoft/MAU2.0/Microsoft AutoUpdate.app"
fi

if [ -e "/Library/Application Support/Microsoft/MAU2.0/Microsoft AutoUpdate.app/Contents/MacOS/Microsoft AU Daemon.app" ]; then
     /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -R -f -trusted "/Library/Application Support/Microsoft/MAU2.0/Microsoft AutoUpdate.app/Contents/MacOS/Microsoft AU Daemon.app"
fi

# Add office apps to com.microsoft.autoupdate2 plist
# Taken from Office Postinstall script and edited
applications="
Word.app
Excel.app
PowerPoint.app
OneNote.app
Outlook.app"

for application in $applications
do
     domain="com.microsoft.autoupdate2"
     defaults_cmd="/usr/bin/defaults"
     application_info_plist="/Applications/Microsoft $application/Contents/Info.plist"
     lcid="1033"

     if /bin/test -f "$application_info_plist"
     then
          application_bundle_signature=$($defaults_cmd read "$application_info_plist" CFBundleSignature)
          application_bundle_version=$($defaults_cmd read "$application_info_plist" CFBundleVersion)
          application_id=$(printf "%s%02s" "$application_bundle_signature" "${application_bundle_version%%.*}")
          $defaults_cmd write $domain Applications -dict-add "/Applications/Microsoft $application" "{ 'Application ID' = $application_id; LCID = $lcid ; }"
     fi
done

/usr/bin/touch $HOME/Library/Preferences/com.myorg.MAUtrustDone.plist
}

# Execute the Functions
checkMAUtrustDone
trustMAU

exit 0
EOF


# Set the correct permissions on the created files
/usr/sbin/chown -R root:wheel "/Library/LaunchAgents/com.myorg.registermau.plist"
/bin/chmod -R 644 "/Library/LaunchAgents/com.myorg.registermau.plist"

/usr/sbin/chown -R root:wheel "/usr/local/bin/RegisterMAU.sh"
/bin/chmod a+x "/usr/local/bin/RegisterMAU.sh"

# Run Once for current user as LaunchAgent will kick-in for next user onwards and we are running the initial run as root.
CurrentloggedInUser=$(/usr/bin/python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "
");')

if [ -e "/Library/Application Support/Microsoft/MAU2.0/Microsoft AutoUpdate.app" ]; then
     sudo -u "$CurrentloggedInUser" /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -R -f -trusted "/Library/Application Support/Microsoft/MAU2.0/Microsoft AutoUpdate.app"
fi

if [ -e "/Library/Application Support/Microsoft/MAU2.0/Microsoft AutoUpdate.app/Contents/MacOS/Microsoft AU Daemon.app" ]; then
     sudo -u "$CurrentloggedInUser" /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -R -f -trusted "/Library/Application Support/Microsoft/MAU2.0/Microsoft AutoUpdate.app/Contents/MacOS/Microsoft AU Daemon.app"
fi

# Add office apps to com.microsoft.autoupdate2 plist
# Taken from Office Postinstall script and edited
applications="
Word.app
Excel.app
PowerPoint.app
OneNote.app
Outlook.app"

for application in $applications
do
     domain="com.microsoft.autoupdate2"
     defaults_cmd="/usr/bin/sudo -u $CurrentloggedInUser /usr/bin/defaults"
     application_info_plist="/Applications/Microsoft $application/Contents/Info.plist"
     lcid="1033"

     if /bin/test -f "$application_info_plist"
     then
          application_bundle_signature=$($defaults_cmd read "$application_info_plist" CFBundleSignature)
          application_bundle_version=$($defaults_cmd read "$application_info_plist" CFBundleVersion)
          application_id=$(printf "%s%02s" "$application_bundle_signature" "${application_bundle_version%%.*}")
          $defaults_cmd write $domain Applications -dict-add "/Applications/Microsoft $application" "{ 'Application ID' = $application_id; LCID = $lcid ; }"
     fi
done

exit 0

jamfmdm
New Contributor

@stevewood Hi, i would like to ask about Rich's article where i need to copy this code?and where in casper i need to put it? do i need to upload it under custom setting under configuration profile?

<?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>PayloadContent</key> <array> <dict> <key>PayloadContent</key> <dict> <key>com.microsoft.autoupdate2</key> <dict> <key>Forced</key> <array> <dict> <key>mcx_preference_settings</key> <dict> <key>HowToCheck</key> <string>AutomaticDownload</string> </dict> </dict> </array> </dict> </dict> <key>PayloadEnabled</key> <true/> <key>PayloadIdentifier</key> <string>MCXToProfile.67ad2621-b510-4060-b971-7f7cf51506c9.alacarte.customsettings.c00e472d-4cb4-4231-8fd4-c7fa866efc00</string> <key>PayloadType</key> <string>com.apple.ManagedClient.preferences</string> <key>PayloadUUID</key> <string>c00e472d-4cb4-4231-8fd4-c7fa866efc00</string> <key>PayloadVersion</key> <integer>1</integer> </dict> </array> <key>PayloadDescription</key> <string>Enable Automatic Download and Installation of Microsoft Office 2016 Updates</string> <key>PayloadDisplayName</key> <string>Enable Automatic Download and Installation of Microsoft Office 2016 Updates</string> <key>PayloadIdentifier</key> <string>com.company.profile.EnableAutomaticDownloadAndInstall</string> <key>PayloadOrganization</key> <string></string> <key>PayloadRemovalDisallowed</key> <false/> <key>PayloadScope</key> <string>System</string> <key>PayloadType</key> <string>Configuration</string> <key>PayloadUUID</key> <string>67ad2621-b510-4060-b971-7f7cf51506c9</string> <key>PayloadVersion</key> <integer>1</integer>
</dict>
</plist>

ryflanagan
New Contributor

Carrying on from Brad's response above, we followed this from derFlounder Blog:

https://derflounder.wordpress.com/2016/10/12/enabling-automatic-download-and-installation-of-microsoft-office-2016-updates/

was very good at improving this, but still reqquires the user to press to search for updates, so we cant automate this well just yet, but has certainly improved the rate in which users update office.

stevewood
Honored Contributor II
Honored Contributor II

@jamfmdm yes, under Configuration Profiles you click the Upload icon and upload the .mobileconfig file to your JSS.

macOS Configuration Profiles

jamfmdm
New Contributor

@stevewood i tried that but i have an error message telling me that "3f9f469619cd46e98bc7e4710b2bde99
The file could not be parsed"

is there any other script for autoupdate?

stevewood
Honored Contributor II
Honored Contributor II

@jamfmdm how are you creating that .mobileconfig file? The error that you have there leads me to believe the formatting of the file is wrong. How did you download/create the file?

Here's what I just did to test:

  1. Open the raw version of Rich's profile from Github AutoUpdate
  2. Select all and copy the text
  3. Open TextMate and paste into a new document
  4. Save from TextMate as "AutoUpdate.mobileconfig" (Saved as UTF-8 with LF)
  5. Upload in JSS

I did not receive the parsing error that you received. Can you confirm that those are the steps you are taking? I would make sure you are not using TextEdit to copy and paste. That often times causes parsing errors like this. If you have to, download Text Wrangler and use it for saving the file.

jamfmdm
New Contributor

@stevewood it's working now.

thanks

itupshot
Contributor II

@Kumarasinghe Hey, that's a great script, and I think it comes in handy if you haven't run MAU in a computer.

But, since I've run MAU on a machine already, can I just use my existing com.microsoft.autoupdate2.plist, add the key for AutomaticDownload, point it to our in-house MAU Caching Server, convert it to a Configuration Profile, and call it a day?

I guess I could still use the launchservice script by @neil.martin83 just to trigger the thing, right?

<?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>Applications</key>
    <dict>
        <key>/Applications/Microsoft Excel.app</key>
        <dict>
            <key>Application ID</key>
            <string>XCEL15</string>
            <key>LCID</key>
            <integer>1033</integer>
        </dict>
        <key>/Applications/Microsoft OneNote.app</key>
        <dict>
            <key>Application ID</key>
            <string>ONMC15</string>
            <key>LCID</key>
            <integer>1033</integer>
        </dict>
        <key>/Applications/Microsoft Outlook.app</key>
        <dict>
            <key>Application ID</key>
            <string>OPIM15</string>
            <key>LCID</key>
            <integer>1033</integer>
        </dict>
        <key>/Applications/Microsoft PowerPoint.app</key>
        <dict>
            <key>Application ID</key>
            <string>PPT315</string>
            <key>LCID</key>
            <integer>1033</integer>
        </dict>
        <key>/Applications/Microsoft Word.app</key>
        <dict>
            <key>Application ID</key>
            <string>MSWD15</string>
            <key>LCID</key>
            <integer>1033</integer>
        </dict>
        <key>/Applications/Skype for Business.app</key>
        <dict>
            <key>Application ID</key>
            <string>MSFB16</string>
            <key>LCID</key>
            <integer>1033</integer>
        </dict>
        <key>/Library/Application Support/Microsoft/MAU2.0/Microsoft AutoUpdate.app</key>
        <dict>
            <key>Application ID</key>
            <string>MSau03</string>
            <key>LCID</key>
            <integer>1033</integer>
        </dict>
    </dict>
    <key>HowToCheck</key>
    <string>AutomaticDownload</string>
    <key>LastUpdate</key>
    <date>2017-02-02T12:15:53Z</date>
    <key>SendAllTelemetryEnabled</key>
    <true/>
    <key>StartDaemonOnAppLaunch</key>
    <true/>
</dict>
</plist>

Kumarasinghe
Valued Contributor

@itupshot the script will trust MAU and also registers each Office applications on MAU to get auto updates working otherwise MAU only update the apps which were previously registered (by opening the app).
e.g. If you have never opened Outlook after install Office 2016, MAU will not auto update Outlook.

(This only applies if you install Office 2016 via command line or via Casper. Manual install has a postinstall script built-in with Office pkg which does the same thing.)

itupshot
Contributor II

@neil.martin83 Your script didn't work for me as is. I get an error logged from Casper Remote when I tested it. Using only the two middle lines also resulted in an error. So I launched MAU manually to test Config Profile.

Good news is that the Config Profile I derived from my com.microsoft.autoupdate2.plist file seems to be working. My test machines are downloading the updates very fast from my local MAU Caching Server. However, it doesn't seem to be logging anything to the /Library/Logs/Microsoft/autoupdate.log file. In fact, it just stays blank, and says it's zero bytes in size.

One thing I noticed is that the MAU still allows the checkbox for "Join the Office Insider program..." to be selected. Shouldn't it gray it out?889e0dfd22314109920af4a13a924849

neil_martin83
Contributor II

@itupshot I think if you run scripts with Casper Remote, the logged in user is detected as root. The script needs to be run by a policy triggered at login - it detects the name of the user logging in and runs those commands to register MAU with Launch Services as that user. :-)

itupshot
Contributor II

@neil.martin83 OK, I'll try it on my second test machine as a policy run at Login. You said the frequency should be "once per user per computer," correct?

neil_martin83
Contributor II

@itupshot Yep that's how I do it.

Nix4Life
Valued Contributor

@itupshot

You need to add the following key to your mobileconfig to disable the "Join the Office Insider program..." check box

<key>DisableInsiderCheckbox</key>
    <true/>

or run the following defaults command as part of your login policy/script ( once per user)

/usr/bin/defaults write /Library/Preferences/com.microsoft.autoupdate2 DisableInsiderCheckbox -bool TRUE

I have used both with no issues

Nix4Life
Valued Contributor
 

itupshot
Contributor II

@LSinNY Thanks for the tip! I'll add that to my "master" com.microsoft.autoupdate2.plist file, and convert it again to a Config Profile for the next round of tests.

itupshot
Contributor II

@neil.martin83 I'm getting this output when the script runs with a lot of these "error -10811" lines.
2a8c6eeb8fd24496b8ca6a1285b84faf

Is that normal?

It looks like it worked, though. When I launch one (or two) of the Office apps, the ones not running are being updated, and I get the notification that there are updates for the ones running.

Any ideas how we can deploy this for users who don't have MAU installed? Currently, we install Office with a choices.xml file that excludes MAU. If I deploy MAU now separately to all those users, they'll get the app asking if it's OK to run. My users pretty much never log out, so it's not easy to sneak this one in for the app to register with Launch Services in the background.

cbrewer
Valued Contributor II

@itupshot Take the "-v" out of your lsregister line(s). This verbose flag is causing you to see these errors.

neil_martin83
Contributor II

@itupshot yep those errors are normal - lsregister literally tries to register every file in the app bundles but only succeeds on the root of the bundles themselves. It's harmless and doesn't mean failure. Keeping the -v flag means you will see that the command has run properly - e.g. if the target app bundle isn't present or has been moved, you'll know. Running it without -v won't give any feedback either way which might hamper troubleshooting later on.

neil_martin83
Contributor II

@itupshot you can also include that script in the policy that installs MAU, to run after the pkg is installed - if a user is logged in, those commands will run in their context and MAU will get registered and won't prompt. If no user is logged in then the commands will fail because su won't have a user to switch to (the policy won't fail though because the script always exits with code 0). Again, harmless. I did this myself when deploying MAU just in case.

dmillertds
Contributor

I'm trying to set this up, but struggling with setting up a MAU cache server. Per the documentation here, I should be able to run this: MAUCacheAdmin --CachePath:/Volumes/web/MAU/cache --CheckInterval:60, but it appears to be ignoring the parameters - I'm just getting the ShowUsage function, which is the default if no params are passed. I suspect it's something I don't know about running BASH scripts in El Cap, but I'm not finding any tricks involved with that. Any help appreciated!

Nix4Life
Valued Contributor

@dmillertds

Is your server cache path /Volumes/web/MAU/cache ? if not that is the problem. What you posted from the help file is an example. My cache path is /Volumes/MAU/MO2016, so the full command would be MAUCacheAdmin --CachePath:/Volumes/MAU/MO2016 --CheckInterval:60, which works and has the last line that reads:
Sleeping for 60 minutes

dmillertds
Contributor

No, forgot to mention that - modified the cache path to match my environment. But it's like it isn't even trying to read the parameters, that's what I'm not getting. I've tried prefixing with "sh " and "sudo sh ", but nothing is working. Actually, I should say that prefixing with "sh " is the only way I can get it to do anything, but then it only returns the ShowUsage verbiage. The actual command I'm running is:

sh MAUCacheAdmin --CachePath:/Volumes/Server SSD/Library/Server/Web/Data/Sites/Default/MSOffice2016Updates/ --Checkinterval:60

dmillertds
Contributor

Any chance the space in the volume name would be causing a problem?

Kumarasinghe
Valued Contributor

This will get you going.

sudo sh MAUCacheAdmin --CachePath:'/Volumes/Server SSD/Library/Server/Web/Data/Sites/Default/MSOffice2016Updates' --CheckInterval:60

bbot
Contributor

I have a mixed environment of Office 2011 and 2016. I'm noticing not all machines have MAU 3.8. Can I push a MAU 3.8 installer to all machines, enable Automatic Download (defaults write com.microsoft.autoupdate2 HowToCheck AutomaticDownload) and expect this to work?

What is the interval in which a machine will check for updates with automatic download?

Nix4Life
Valued Contributor

@dmillertds have you tried using the absolute path? I have the MAUCacheAdmin binary in /usr/local/. so the full command is

sudo /usr/local/MAUCacheAdmin --CachePath:/Volumes/MAU/MO2016 --CheckInterval:60

@bbot Yes, however you will may need to update com.microsoft.autoupdate2 via defaults write, modify the profile above or run @Kumarasinghe's script to reflect the addition of the Office 2011 apps

dmillertds
Contributor

@Kumarasinghe and @LSinNY - thank you both! I combined your suggestions and it finally worked. I had already CD'ed to /usr/local, so I don't know why I had to put in the path, but it did work. And I should have tried the single-quotes around the cache location. I had tried double, but that didn't work.

Nix4Life
Valued Contributor

Glad you got it working. just so you know, if you do cd into /usr/local/, you can run the command by adding "./"
to run the MAUCacheAdmin binary directly

sudo (if applicable) ./MAUCacheAdmin --CachePath:/Volumes/MAU/MO2016 --CheckInterval:60

bbot
Contributor

How can I force the enable insider build using a configuration profile?

I'm creating 2 mobileconfigs, one to disable for most of the company, and another to enable Officer Insider for our internal technology department for testing purposes.

itupshot
Contributor II

I've updated the MAU clients to v. 3.9, and now we can't download updates from the MAU Caching Server. We keep getting this error:

8a0c2c084ccb435eb89d3a2dae6e168b

EDIT: Never mind. I didn't give the server enough time to download the updates. They're all in now, and we can download.

btrav
New Contributor II

@neil.martin83 How often does the MAU 3.9 app check for updates by default? I ran the script that registers the Office apps with MAU and installed a profile to auto download and install and lock out the MAU prefs. I had to put the clock forward on the Mac a couple of weeks to get all of the Office 2016 apps to auto update silently. We are not using a MAU caching server. For instance Word, Outlook and Powerpoint updated right away but then Excel and OneNote did not until I set the clock forward a few weeks.