Making Microsoft AutoUpdate check manually for Macs with Munki


Note: I’m writing with regard to Microsoft Office for 2011. It’s possible the .plist file updates here is different for other versions of Microsoft Office for Mac.

If you’re using Munki to manage software updates, you don’t want the applications themselves to be constantly checking for updates or notifying your users when an update is available. Just as you can disable Java update prompts and disable Adobe Flash player prompts, you can also disable Microsoft Office update prompts.

To do so from the GUI (graphical user interface), you open up an MS Office application like Word, and then go to Help and Check for Updates.

microsoftautoupdate
You’ll then see something like this, and you can change it from Automatically to Manually.

But with a bunch of Munki clients, you don’t want to do that for each user. The whole point of Munki is to automate things, so what you really want to do is invoke a terminal command that you can script:

defaults write com.microsoft.autoupdate2 HowToCheck “Manual”
That one command does it for only the logged-in user if the user runs it. Any package you distribute via Munki (I’d highly recommend Packages as a way to point-and-click-create a package with no payload and only a script) will run as root, so you probably want to do something a bit more complicated to make sure you have your bases covered.

I created the following script that loops through all the existing users, changes their preferences from automatic to manual, makes sure they’re still the owner of the .plist that’s been changed (instead of root owning it) and then changing the default global setting from automatic to manual for any users created in the future (and, yes, I’ve tested it—changing it in /Library/Preferences will affect newly-created users).

#!/bin/bash

# Declare a function to delete the user files
fix_existing_users(){

# Make sure it’s not the general “Shared” user
if [[ $1 != “Shared” ]]; then

sudo defaults write /Users/$1/Library/Preferences/com.microsoft.autoupdate2 HowToCheck “Manual”

# Assign a temporary variable for the exit status of the last command
rc=$?

# Check that the exit status is 0 (i.e., good)
if [[ $rc == 0 ]]; then

# Make sure, even though we ran sudo, that the user is still the owner of that file
sudo chown $1 /Users/$1/Library/Preferences/com.microsoft.autoupdate2.plist

fi

fi
}

# Loop through the /Users directory
cd /Users

for d in *
do
fix_existing_users $d
done

# Fix the global one, too
sudo defaults write /Library/Preferences/com.microsoft.autoupdate2 HowToCheck “Manual”
Just make that package and mark it in the pkgsinfo .plist as an update for Microsoft Office, and then it should push out to your users when they check for updates.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.