ByHost Prefrences

rob_potvin
Contributor III
Contributor III

Setting up a bunch of exam laptops for our upcoming IB exams here at the school and I am having trouble with the byhost prefrences. I need to take off some icons from the top bar and also add different language keyboards. Also all these machines are offline, no internet so was thinking of installing the required byhost prefs after imaging and then as a post flight to run the

jamf fixByHostPrefrences -target

but its not working, it doesn't actually put the UUID but the MAC Address.

So asking the community, have a renaming script kicking around or ideas on how to use the jamf bin

10.6.8 macbooks new (but discontinued)

Cheers

1 ACCEPTED SOLUTION

themacdweeb
Contributor

same deal here although our isolating the UUID is slightly different than the esteemed mr. nichols. our issue was pre-setting the Java Prefs application to have the "Enable WebApps" button checked. our process:

1) snapshot the file you need on a machine that's already on and working the way you like. 2) lay the file down in a build and - on first boot - rename it with the correct UUID tag.
3) do that for all visible user accounts, i.e., those over UID 500

Our script looks big for what it is, but the log it produces is awfully nice.

Enjoy...

#!/bin/sh

# ---------------------------------------------------------
# SCRIPT INFO
#
# this script renames the java prefs on a mac for all users
# to include the UUID info into the new name of the file
# ---------------------------------------------------------

# ------------------
# variables
# ------------------

SCRIPTNAME=$0
LOG="/Library/Logs/Getty Installations.log"
over500=dscl . list /Users UniqueID | awk '$2 > 500 { print $1 }'
UUID=ioreg -rd1 -c IOPlatformExpertDevice | awk '/IOPlatformUUID/ { split($0, line, """); printf("%s ", line[4]); }'

echo " " >> $LOG
echo "###################################" >> $LOG
echo "########## Beginning Log ##########" >> $LOG
echo "##### Turning on Java WebApps #####" >> $LOG
echo "###################################" >> $LOG
echo " " >> $LOG
echo `date "+%A %m/%d/%Y %H:%M"` >> $LOG
echo Script: $SCRIPTNAME >> $LOG
echo " " >> $LOG

# --------------------------------------------------
# set script to loop through all users > 500
# --------------------------------------------------
for i in $over500
do
echo "----------------------------------------" >> $LOG
echo " FOR THE USER ACCOUNT: $i" >> $LOG
echo "----------------------------------------" >> $LOG

if [ -d /Users/$i/Library/Preferences/ByHost/ ]; then cd /Users/$i/Library/Preferences/ByHost/ mv com.apple.java.JavaPreferences.*.plist com.apple.java.JavaPreferences."${UUID}".plist echo "pList name of the JavaPrefs plist " >> $LOG echo "has been changed for the $i account..." >> $LOG echo " " >> $LOG fi
done

echo " " >> $LOG
echo "###################################" >> $LOG
echo "########### Ending Log ###########" >> $LOG
echo "###################################" >> $LOG
echo " " >> $LOG

exit 0

View solution in original post

5 REPLIES 5

jarednichols
Honored Contributor
system_profiler | grep 'Hardware UUID' | cut -d " " -f 9

will return your UUID. Plop that in a script with some mv commands and you should be good to go. Off to a meeting at the moment, but if you need a hand, let me know.

themacdweeb
Contributor

same deal here although our isolating the UUID is slightly different than the esteemed mr. nichols. our issue was pre-setting the Java Prefs application to have the "Enable WebApps" button checked. our process:

1) snapshot the file you need on a machine that's already on and working the way you like. 2) lay the file down in a build and - on first boot - rename it with the correct UUID tag.
3) do that for all visible user accounts, i.e., those over UID 500

Our script looks big for what it is, but the log it produces is awfully nice.

Enjoy...

#!/bin/sh

# ---------------------------------------------------------
# SCRIPT INFO
#
# this script renames the java prefs on a mac for all users
# to include the UUID info into the new name of the file
# ---------------------------------------------------------

# ------------------
# variables
# ------------------

SCRIPTNAME=$0
LOG="/Library/Logs/Getty Installations.log"
over500=dscl . list /Users UniqueID | awk '$2 > 500 { print $1 }'
UUID=ioreg -rd1 -c IOPlatformExpertDevice | awk '/IOPlatformUUID/ { split($0, line, """); printf("%s ", line[4]); }'

echo " " >> $LOG
echo "###################################" >> $LOG
echo "########## Beginning Log ##########" >> $LOG
echo "##### Turning on Java WebApps #####" >> $LOG
echo "###################################" >> $LOG
echo " " >> $LOG
echo `date "+%A %m/%d/%Y %H:%M"` >> $LOG
echo Script: $SCRIPTNAME >> $LOG
echo " " >> $LOG

# --------------------------------------------------
# set script to loop through all users > 500
# --------------------------------------------------
for i in $over500
do
echo "----------------------------------------" >> $LOG
echo " FOR THE USER ACCOUNT: $i" >> $LOG
echo "----------------------------------------" >> $LOG

if [ -d /Users/$i/Library/Preferences/ByHost/ ]; then cd /Users/$i/Library/Preferences/ByHost/ mv com.apple.java.JavaPreferences.*.plist com.apple.java.JavaPreferences."${UUID}".plist echo "pList name of the JavaPrefs plist " >> $LOG echo "has been changed for the $i account..." >> $LOG echo " " >> $LOG fi
done

echo " " >> $LOG
echo "###################################" >> $LOG
echo "########### Ending Log ###########" >> $LOG
echo "###################################" >> $LOG
echo " " >> $LOG

exit 0

rob_potvin
Contributor III
Contributor III

Cool Thanks so much!! That is exactly what I am looking for have about 5 different by host prefs that need to be you know "renamed"

@jarednichols I got that far just needed to go one more step, it was 8pm at night and thought I would ask the community!

Thanks

jhenkel
New Contributor

Just a small update: in 8.52 it looks like it is working again: it uses UUID if you do a
jamf fixByHostFiles -target /

exit 0

CasperSally
Valued Contributor II

I'm seeing ByHost issues post imaging with 8.52, but only (so far from my testing) on non unibody macbooks. If I run jamf fixByHostFiles on the effected machines, it errors out.

Emailed JAMF support.