Need Help creating EA to get MAU Caching Server Address

Eigger
Contributor III

Hi Admins,

Is this correct or no? Need a little help please, Thanks in advance.

#!/bin/sh
MAUServer=`defaults read /Users/$USER/Library/Preferences/com.microsoft.autoupdate2 UpdateCache`

echo "<result>$MAUServer</result>"
5 REPLIES 5

Nix4Life
Valued Contributor

@Eigger looks good, got expected results on my test system,how do you have $USER variable defined?

L

tlarkin
Honored Contributor

Here is a quick Python ObjC script that can be used to read the value of any plist file

#!/usr/bin/python

from CoreFoundation import CFPreferencesCopyAppValue
from SystemConfiguration import SCDynamicStoreCopyConsoleUser
from Foundation import NSHomeDirectoryForUser



currentuser, uid, gid = SCDynamicStoreCopyConsoleUser(None, None, None)
user_home_folder = NSHomeDirectoryForUser(currentuser)
plist_file = 'com.microsoft.autoupdate2'
key = 'UpdateCache'
domain = str('%s' + '/Library/Preferences/' + '%s') % (user_home_folder, plist_file)


value = CFPreferencesCopyAppValue(key, domain)

print '<result>%s</result>' % value

To reuse this just replace the values in plist_file and the key you are looking to get. I don't have that setting in my MS Office setup, but I was able to pull other keys out of it.

talkingmoose
Moderator
Moderator

A Microsoft AutoUpdate (MAU) caching server address is one of those settings you probably want to enforce. I have plists here for different MAU settings that you can upload to your JSS and push to your Macs as configuration profiles.

https://github.com/talkingmoose/Microsoft-Office-2016-for-Mac-Management/tree/master/AutoUpdate

donmontalvo
Esteemed Contributor III

Definitely something you'd want to manage at the Computer Level using a Configuration Profile.

Suite-Wide Preferences | MGMT200

--
https://donmontalvo.com

Eigger
Contributor III

@LSinNY I use the following to get the $USER

#!/bin/bash
#EA for MAU Caching Server Address
USER=ls -l /dev/console | awk '{print $3}'
String=`defaults read /Users/$USER/Library/Preferences/com.microsoft.autoupdate2 UpdateCache -string "$UpdateCache"`

echo "<result>$String</result>"

@talkingmoose Yes Sir, I actually do use a lot of your config profiles over here, you are such a big help to the community, Thank you! I just need an EA for Inventory use and smartgroup.

What I noticed though is before I just use the "Files and Processes" to run the

defaults write com.microsoft.autoupdate2 UpdateCache -string http://mau.domain.com

and discovered its not working, because its being run as root. So I just scripted it and made sure the script run as the logged in user. I must have misunderstood something from the instructions.