Posted on 07-25-2014 09:22 AM
I was wondering if anyone has found a quick, efficient way to do populate the favoriteservers in com.apple.sidebarlists.plist - I tried uploading plist to config profile, and configuring, all MCX to no avail. I saw a few scripts, but they didn't seem to work or were overkill for what I needed and they were really old. Does anyone have this working in their environment with minimal effort, and easy to update? would you mind sharing?
I was able to accomplish this packaging the plist and using FEU/FUT and deploying it as a policy, and adding to self service. After a restart, it worked fine. we didn't care what the user had in this list and we straight overwrote, and deploy with the once per computer trigger, allowing user to add. I know there is away using the defaults command, but could not get the syntax corrrect...
any input will be appreciated.
Posted on 04-20-2015 06:41 PM
+1 - Need help with this too.
Posted on 04-21-2015 05:41 AM
Here is my solution on Github.
#!/bin/bash
bud='/usr/libexec/Plistbuddy'
plist=$HOME'/Library/Preferences/com.apple.sidebarlists.plist'
servers=('afp://servername'
'smb://servername'
'vnc://servername'
'ftp://servername')
killall cfprefsd
echo "Setting servers for $plist"
echo "Removing previous entries..."
${bud} -c "Delete favoriteservers" ${plist}
echo "Creating new list..."
${bud} -c "Add favoriteservers:Controller string CustomListItems" ${plist}
${bud} -c "Add favoriteservers:CustomListItems array" ${plist}
for i in "${!servers[@]}"
do
echo "Adding to Favorite Servers: ${servers[$i]}..."
${bud} -c "Add favoriteservers:CustomListItems:$i:Name string ${servers[$i]}" ${plist}
${bud} -c "Add favoriteservers:CustomListItems:$i:URL string ${servers[$i]}" ${plist}
done
echo "Finalizing settings..."
killall cfprefsd
defaults read ${plist} favoriteservers > /dev/null
Posted on 04-21-2015 02:46 PM
Thanks - I'll try this.