Posted on 03-31-2023 03:56 PM
I've been using DockMaster for quite awhile and it's great up until a new OS comes out and Apple changes the name or location of an app which I realize isn't a unique issue to DockMaster however if I could set static apps with dockutil then I'd only have to modify the parts of the script that need changing whereas currently with DockMaster I have to reconfigure the entire dock on the web interface since it doesn't save your config, then generate a new pkg, upload it to JAMF, modify my policy etc.
So the question is, can Dockutil set static apps? Currently I set our self service and school / state assessment apps as static on the dock so I can guarantee every student has the app on the dock in the same place when its time for testing, everything else can be changed by the user.
Here is a sample of the plist generated by DockMaster that places those static apps.
<key>static-apps</key>
<array>
<dict>
<key>tile-data</key>
<dict>
<key>file-data</key>
<dict>
<key>_CFURLString</key>
<string>/Applications/Self Service Center.app</string>
<key>_CFURLStringType</key>
<integer>0</integer>
</dict>
</dict>
<key>tile-type</key>
<string>file-tile</string>
</dict>
<dict>
<key>tile-data</key>
<dict>
<key>file-data</key>
<dict>
<key>_CFURLString</key>
<string>/Applications/NWEA Secure Testing Browser.app</string>
<key>_CFURLStringType</key>
<integer>0</integer>
</dict>
</dict>
<key>tile-type</key>
<string>file-tile</string>
</dict>
<dict>
<key>tile-data</key>
<dict>
<key>file-data</key>
<dict>
<key>_CFURLString</key>
<string>/Applications/DRC INSIGHT Online Assessments/DRC INSIGHT Online Assessments.app</string>
<key>_CFURLStringType</key>
<integer>0</integer>
</dict>
</dict>
<key>tile-type</key>
<string>file-tile</string>
</dict>
<dict>
<key>tile-data</key>
<dict>
<key>file-data</key>
<dict>
<key>_CFURLString</key>
<string>/Applications/NWEA State Solutions Secure Browser/NWEAStateSolutions.app</string>
<key>_CFURLStringType</key>
<integer>0</integer>
</dict>
</dict>
<key>tile-type</key>
<string>file-tile</string>
</dict>
</array>
Posted on 06-23-2023 06:11 PM
Just in case anyone else comes across this and is curious. I solved my issue in 2 parts. Using the DockMaster website and dockutil which of course requires dockutil also be installed on the client machine.
On DockMaster's website I configured a dock with only the apps and items I wanted to be permanent, self service, assessment apps and applications, documents and downloads folders. Choosing the pkg option at the bottom and clicking Generate downloads a zip file with a plist payload, postinstall script and a makepackage.command. Running makepackage.command generates a pkg to be uploaded to JAMF and added to a policy.
Then in that same policy I add the script below to add the rest of the apps that I don't care if students change but might be helpful. I nabbed and modified this script either from here or the dockutil documentation.
#!/bin/sh
#
# we need to wait for the dock to actually start
until [[ $(pgrep Dock) ]]; do
wait
done
LoggedInUser=$(/usr/sbin/scutil <<< "show State:/Users/ConsoleUser" | /usr/bin/awk -F': ' '/[[:space:]]+Name[[:space:]]:/ { if ( $2 != "loginwindow" ) { print $2 }}')
LoggedInUserPlist="/Users/$LoggedInUser/Library/Preferences/com.apple.dock.plist"
echo "Logged in user is $LoggedInUser"
echo "Logged in user's plist $LoggedInUserPlist"
dockutilVersion=`/usr/local/bin/dockutil --version --version`; echo "dockutil version: $dockutilVersion"
du="/usr/local/bin/dockutil"
# Clear the default dock
$du --remove all --no-restart $LoggedInUserPlist; sleep 2
#Set dock items
$du --add '/System/Applications/Mail.app' --no-restart --position 1 $LoggedInUserPlist
$du --add '/Applications/Google Chrome.app' --no-restart --position 2 $LoggedInUserPlist
$du --add '/Applications/Safari.app' --no-restart --position 3 $LoggedInUserPlist
$du --add '/Applications/Pages.app' --no-restart --position 4 $LoggedInUserPlist
$du --add '/Applications/Microsoft Word.app' --no-restart --position 5 $LoggedInUserPlist
$du --add '/Applications/Numbers.app' --no-restart --position 6 $LoggedInUserPlist
$du --add '/Applications/Microsoft Excel.app' --no-restart --position 7 $LoggedInUserPlist
$du --add '/Applications/Keynote.app' --no-restart --position 8 $LoggedInUserPlist
$du --add '/Applications/Microsoft PowerPoint.app' --no-restart --position 9 $LoggedInUserPlist
$du --add '/System/Applications/Music.app' --no-restart --position 10 $LoggedInUserPlist
$du --add '/Applications/GarageBand.app' --no-restart --position 11 $LoggedInUserPlist
$du --add '/System/Applications/Photos.app' --no-restart --position 12 $LoggedInUserPlist
$du --add '/Applications/iMovie.app' --no-restart --position 13 $LoggedInUserPlist
$du --add '/System/Applications/System Settings.app' --no-restart --position 14 $LoggedInUserPlist
killall Dock
exit 0
I scope this policy to a smart group with criteria that says the computer has all the apps I want to appear on the dock so it doesn't run too soon. The end result is that the pkg installs and the permanent items are added and the dock reloads then the script runs and the dock reloads once more and everything is set. Might not be the best way to do it but its working as of Ventura 13.4.1