Please check the script below: It is not working when pushed from Jamf but working using the terminal.
Thoughts?
Thanks!
Raj.
#!/bin/sh
#Finds current username and defines a variable currentuser=`stat -f "%Su" /dev/console`
#Substituting as user stored in variable to modify plist #su "$currentuser" -c "<command to run>"
#Add Movies, Music, Pictures, <username>, to Finder Favorites sidebar.
su "$currentuser" -c "mysides add com.apple.LSSharedFileList.FavoriteItems file:///Applications"
su "$currentuser" -c "mysides add com.apple.LSSharedFileList.FavoriteItems file:///Users/$currentuser"
su "$currentuser" -c "mysides add com.apple.LSSharedFileList.FavoriteItems file:///Users/$currentuser/Movies"
su "$currentuser" -c "mysides add com.apple.LSSharedFileList.FavoriteItems file:///Users/$currentuser/Music"
su "$currentuser" -c "mysides add com.apple.LSSharedFileList.FavoriteItems file:///Users/$currentuser/Pictures"
su "$currentuser" -c "mysides add com.apple.LSSharedFileList.FavoriteItems file:///Users/$currentuser/Downloads"
su "$currentuser" -c "mysides add com.apple.LSSharedFileList.FavoriteItems file:///Users/$currentuser/Documents"
#Restarts cfprefsd and Finder
killAll cfprefsd killAll Finder
echo "Finder Preferences set"
exit 0
"mysides" is a separate application that can be installed via homebrew; it is not included by default on macOS.
If you distributed mysides first and then ran this script with the complete path to the binary (say /usr/local/bin/mysides), your changes should take effect.
"mysides" is a separate application that can be installed via homebrew; it is not included by default on macOS.
If you distributed mysides first and then ran this script with the complete path to the binary (say /usr/local/bin/mysides), your changes should take effect.
I can second this. I figured out how to use it, and it works. You can also install it from the "Releases" section on GitHub (Releases ยท mosen/mysides (github.com)). You may to re-sign the package using your Jamf Pro signing certificate (I had to do this), then deploy the signed package to your mcabooks. After it is deployed, you can create a script to run the mysides commands that you want.