Dock Items

Luket
New Contributor

I have just created a new build of OS X 10.11.4 and I have pushed out a dock configuration for some computers but I'm seeing questions marks appearing on them for dock items that are apart of another build. anyone got any suggestions?d4557867a3ef44099ab0d1e611d0899f

5 REPLIES 5

Look
Valued Contributor III

Those are dock items delivered that don't exist on the target machine (or the path doesn't quite match).
If you planning to do any complexe dock configuration it's really worth learning how to use dockutil, it's complex but once you sort it it's great and it deals very cleanly with missing items.

jmahlman
Valued Contributor

I'm currently modifying a simple script created by someone in the MacAdmins slack that scripts dock creation using dockutil to solve this very problem. So far it's working really well in my test environment.

dockMaster script

Basically you need dockutil installed (the script checks for it) and you can customize dock items per computer type, user, or group; my script uses a dummy receipt to find out the type of computer. I set the script to run once per computer per user and if you have multiple users on a machine without AD you can use the "--allhomes" flag on the dock to set all users to have the same dock.

You can set it to check if the app is installed, add the icon, if not..don't add it. Stops the question marks from coming up.

millersc
Valued Contributor

@jmahlman I'm curious how your setting the "cohort" file? I'm looking at this and thinking of summer changes.

jmahlman
Valued Contributor

@millersc A"cohort" is just a dummy receipt that we use to differentiate computer types in our environment. It's a text file that we place in a hidden the folder '/Library/JAMF DM/Cohort" with the name "RECEIPT-<type>.txt" and in that file is the type. So for example, we have "RECEIPT-OFFICE.txt" and inside it just says "OFFICE."

We put that file in at image time with a DMG. This is also how we keep computers in Smart groups for their appropriate types instead of going with a naming convention. Works very well! Plus, it's very easy to change cohorts if you re-purpose a computer.

For our public cohorts (we have several different ones we consider "public") we have a script that matches the beginning of the computer name and writes the cohort file.

Here's part of our script:

#!/bin/sh
lab () {
echo "LAB" > /Library/JAMF DM/Cohort/RECEIPT-LAB.txt
}

studio () {
echo "STUDIO" > /Library/JAMF DM/Cohort/RECEIPT-STUDIO.txt
}

suite () {
echo "SUITE" > /Library/JAMF DM/Cohort/RECEIPT-SUITE.txt
}

smart_classroom () {
echo "SMART-CLASSROOM" > /Library/JAMF DM/Cohort/RECEIPT-SMART-CLASSROOM.txt
}

# Get room number.
roomNumber=`scutil --get ComputerName | awk 'BEGIN {FS="-"} END {print $1}' | tr "[a-z]" "[A-Z]"`

# Make "JAMF DM" directory and hide it.
mkdir /Library/JAMF DM
mkdir /Library/JAMF DM/Cohort
chflags hidden /Library/JAMF DM

# Automatically choose the appropriate cohort based on room number.
elif [ $roomNumber == "T1703" ]; then
smart_classroom

elif [ $roomNumber == "TEMP" ]; then
lab

elif [ $roomNumber == "T1409" ]; then
suite

else
echo "$roomNumber does not match any public spaces. No cohort will be added."
exit 1

fi

Note: I didn't write the cohort script, this was in place when I started here :)

millersc
Valued Contributor

@jmahlman Thank you! That's what I was wondering, when and how you were placing it. Imaging is when I'm also placing some other information from DSS, so I'll ponder adding this in also.