Have you used this script pushed out to machines through Jamf. I've tested it locally as well and everything seems to be good, but trying to target a logged in user is a little finicky. I can grab the logged in user in various ways but dockutil seems to only target Jamf's root user.