We are using Dockutil to take everything off the Dock and the populate it with a few items the first time a user logs in. We have been using a similar script on High Sierra and Mojave for a few years and it works great. Below the script is the error message I receive. I am logging in using a dummy user called Scott Towels (TowelsS). After it bombs when Scott logs in, if I go in and flush the policy in Jamf and then login as Scott again, the script runs fine and the Dock is perfect. It almost appears that Catalina on first login has not fully finished creating the users directories, therefore the com.apple.dock.plist is not there yet when the script attempts to run
!/bin/sh
sleep 20
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 + "
");')
su $LoggedInUser -c '/usr/local/bin/dockutil --remove all --no-restart'
su $LoggedInUser -c '/usr/local/bin/dockutil --add /Applications/Google Chrome.app --position 1 --no-restart'
su $LoggedInUser -c '/usr/local/bin/dockutil --add /Applications/Microsoft Word.app --position 2 --no-restart'
su $LoggedInUser -c '/usr/local/bin/dockutil --add /Applications/Microsoft Excel.app --position 3 --no-restart'
su $LoggedInUser -c '/usr/local/bin/dockutil --add /System/Applications/Calculator.app --position 4 --no-restart'
su $LoggedInUser -c '/usr/local/bin/dockutil --add /Applications/Acronis Files Connect.app --position 5 --no-restart'
su $LoggedInUser -c '/usr/local/bin/dockutil --add /System/Applications/Photos.app --position 6 --no-restart'
su $LoggedInUser -c '/usr/local/bin/dockutil --add /System/Applications/Music.app --position 7'
Executing Policy z2-Dockutil Catalina
Running script Dockutil Catalina...
Script exit code: 1
Script result: /Users/towelss/Library/Preferences/com.apple.dock.plist does not seem to be a home directory or a dock plist
/Users/towelss/Library/Preferences/com.apple.dock.plist does not seem to be a home directory or a dock plist
[message repeats 6 times]
Error running script: return code was 1.
