Hey Everyone, hoping someone can help. we're getting all kinds of crazy errors in JAMF when trying to remove a dock item using Dockutil. Everything from root access to dock item not found, to argument not supported. It can't be this hard, is it? Trying to do this in Monterey on the M1 MBPs. Here's what i've been trying to push out. A simple script. Running it locally works. Am i doing something wrong here:
#!/bin/zsh
loggedInUser=$( scutil <<< "show State:/Users/ConsoleUser" | awk '/Name :/ && ! /loginwindow/ { print $3 }' )
dockutilbin="/usr/local/bin/dockutil"
loggedInUserPlist="/Users/$loggedInUser/Library/Preferences/com.apple.dock.plist"
$dockutilbin --remove file:///Applications/BarcodeForVerification2021/Barcode\\ x14.app --restart $loggedInUserPlist
exit 0

