Setting Dock once for New Users

hodgesji
Contributor

We are trying to set the dock for new users that get created and still give them the ability to customize afterwards. Normally, we would use the User Template for this, but then a few issues come up such as Apple adding in their extra apps for every OS (Maps, Siri, etc.) and User Templates doesn't let us add a ~/Documents or ~/Downloads properly. Anyone else using a solution for this?

Configuration Profiles don't work because we want the users to modify the dock. We are aware of DockUtil, but didn't know if there was an easier way to set the dock once for each new user, not ongoing?

10 REPLIES 10

Cornoir
Contributor II

You might want to look at my post regarding dockfixup and High Sierra (assuming you are using 10.13.x):

https://www.jamf.com/jamf-nation/discussions/25577/com-apple-dockfixup-plist-and-high-sierra

Dockuitil might be the only answer till Apple fixes High Sierra of all it's quirks.

rderewianko
Valued Contributor II

You could do something like this, using the --allhomes flag for dockutil which sets it up for all users docks on that machine..

#!/bin/bash

echo "running dockutil"
DOCKUTIL=/usr/local/bin/dockutil
loggedInUser=$(python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "
");')

echo "remove default apps"
# remove default apps 
$DOCKUTIL --remove all --no-restart --allhomes
echo "adding to dock"
# add items to dock
$DOCKUTIL --add /Applications/Safari.app --position 1 --no-restart --allhomes
$DOCKUTIL --add /Applications/Firefox.app --after Safari --no-restart --allhomes
$DOCKUTIL --add /Applications/Google Chrome.app --after Firefox --no-restart --allhomes
$DOCKUTIL --add /Applications/Self Service.app --after "Google Chrome" --no-restart --allhomes
$DOCKUTIL --add /Applications/Slack.app --after "Self Service" --no-restart --allhomes
$DOCKUTIL --add '/Applications/System Preferences.app' --after "Slack" --no-restart --allhomes


$DOCKUTIL --add '/Applications' --view grid --display folder --sort name  --section others --position 1 --allhomes
$DOCKUTIL --add '~/Documents' --view list --display folder --section others  --position 2 --allhomes
$DOCKUTIL --add '~/Downloads' --view list --display folder --sort dateadded --section others --position end --allhomes

exit 0

If you Dropped all homes you could just run it once per a user per a machine.

hodgesji
Contributor

Thanks for your responses!

@rderewianko The problem with this, is we don't want to change it for existing users. We only want new users to get a standard dock to start with. All of our machines are bound to AD and setup with mobile accounts so new accounts get created anytime they login for the first time. The --allhomes flag only changes the dock for existing users on the machine.

I think we are going to try an approach with Launch Agents and dockutil so we change it on login. I'll repost the solution we use if it works well.

Chriskmpruitt
Contributor

@rderewianko how did your Launch Agent solution go?

jmahlman
Valued Contributor

I wrote something up for use in some of our labs, it just runs as a login policy so we can scope to certain machines/users.

Dock Master

itupshot
Contributor II

Does anyone know if dockutil can use wildcard? For example, if I tell it to remove all "Adobe" apps, instead of explicitly typing in their names.

robertliebsch
Contributor

I have great luck with using Casper Admin to capture dock items. Then create a policy that manages the items Added/Removed and order in the Dock...

itupshot
Contributor II

@robertliebsch I usually do this: I capture the Dock icons for all the apps we install. In this case, however, the icons were installed from the User Template, so I don't have them in JSS for separate removal.

I can probably issue a defaults delete to the Dock.plist to get rid of them.

robertliebsch
Contributor

@itupshot You can install Casper Admin on any machine to capture the doc icons. Then in JSS web, you can set the rest via policy...

itupshot
Contributor II

@robertliebsch Yes, I suppose I can do that, but it would take care of only the base apps. However, there were other apps that some users installed later, that we no longer have saved Dock icons for in JSS. It's somthing, though. Thanks for the suggestion.