dockutil icon indicating copy to clipboard operation
dockutil copied to clipboard

Dockutil Does not change all homes

Open Dfree2 opened this issue 6 years ago • 1 comments

Hi,

First off, great tool and thank you for developing it and supporting it.

I posted this on Jamf Nation first, but here is the copypasta:

So as part of our enrollment process, we change the dock using dockutil. With our DEP machines, we also "Create an additional local administrator account" (UID 501) which is a feature of Jamf.

However, if I log out of the account that a typical employee would create/use (UID 502...and dockutil works just fine on this user)...and log back in as our admin user (UID 501) that is created as part of DEP...the dock is not changed.

Any ideas as to why or how to get the admin account the same dock? Is it because the user is not logged into before running the dockutil command?

I have had the same problem on all versions of High Sierra and all versions of Mojave including the just released 10.14.3. We're been on Jamf 10.9.0 for awhile now if that matters at all.

The script I run as part of one my policies:

#!/bin/bash

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 + "\n");')

# remove default apps
$DOCKUTIL --remove all --no-restart --allhomes

# add items to dock
$DOCKUTIL --add /Applications/Safari.app --position 1 --no-restart --allhomes
$DOCKUTIL --add /Applications/Preview.app --after Safari --no-restart --allhomes
$DOCKUTIL --add /Applications/Calendar.app --after Preview --no-restart --allhomes
$DOCKUTIL --add /Applications/Microsoft\ Outlook.app --after Calendar --no-restart --allhomes
$DOCKUTIL --add /Applications/Microsoft\ Word.app --after "Microsoft Outlook" --no-restart --allhomes
$DOCKUTIL --add /Applications/Microsoft\ Excel.app --after "Microsoft Word" --no-restart --allhomes
$DOCKUTIL --add /Applications/Microsoft\ PowerPoint.app --after "Microsoft Excel" --no-restart --allhomes
$DOCKUTIL --add '/Applications/System Preferences.app' --after "Self Service" --no-restart --allhomes


$DOCKUTIL --add '/Applications' --view auto --display stack --sort name  --section others --position 1 --no-restart --allhomes
$DOCKUTIL --add '~/Documents' --view auto --display stack --section others  --position 2 --no-restart --allhomes
$DOCKUTIL --add '~/Downloads' --view auto --display stack --sort dateadded --section others --position end --allhomes

exit 0

Dfree2 avatar Jan 25 '19 16:01 Dfree2

Hello Dfree,

We use a script like this and it works with all users: DockUsers.txt maybe you can do something with this.

mvught avatar Jan 25 '19 19:01 mvught