How to add server folder to server address box

j_grafton
New Contributor III

Hi,
I have seen people talk about a plist that stores the server addresses in the go- connect to server - server address box.
I can't seem to see a plist on any of my machines even if I add a server address manually.
Any help appreciated
thanks

1 REPLY 1

HappyMarcus
New Contributor II

Hi,
was a while back since I did this but finally solved it this way (if I remember correctly):

The settings are stored in this file: ~/Library/Application/Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.FavoriteServers.sfl2

So, simply add the servers manually in Finder as you usually would do. Then create a .DMG using composer to add this file in the users folder. Upload this to JAMF and choose Fill User Templates and Fill Existing User Home Directories in the policy.

And, also you need a script to get it working afterwards. In this case we simply use the full IP-address including SMB (which I don't think is necessary), if you want a more user friendly name you'll need to change that in the script.

#!/bin/bash

USER=$(/bin/ls -l /dev/console | /usr/bin/awk '{print $3}')
plist=/Users/$USER/Library/Preferences/com.apple.sidebarlists.plist

servers=(
'smb://192.168.0.10'
)

killall cfprefsd
echo "Setting servers for $plist"

#Add favouriteservers
echo "Creating new list..."
/usr/libexec/PlistBuddy -c 'add favoriteservers:CustomListItems array' "${USER}"/Library/Preferences/com.apple.sidebarlists.plist
/usr/libexec/PlistBuddy -c 'add favoriteservers:Controller string "CustomListItems"' "${USER}"/Library/Preferences/com.apple.sidebarlists.plist

for i in "${!servers[@]}"
do
    echo "Adding to Favorite Servers: ${servers[$i]}..."
    /usr/libexec/Plistbuddy -c "Add favoriteservers:CustomListItems:$i:Name string ${servers[$i]}" ${plist}
    /usr/libexec/Plistbuddy -c "Add favoriteservers:CustomListItems:$i:URL string ${servers[$i]}" ${plist}
done

echo "Finalizing settings..."

killall cfprefsd

#kill sharedfilelistd process to reload file. Finder should be closed when this happens
killall sharedfilelistd

defaults read ${plist} favoriteservers > /dev/null

105ed93051e24a519ff88d975a304ec3

f27707dfaf48432d9de6de648b6fabb2
Hope this helps!