You evidently already know about the defaults
command. So why are you using it as a way to manipulate preference plist files? You shouldn't do that. Use the defaults
command the way it's meant to be used to just modify the preferences in the cached database and let cfprefsd
write the updated cache to the file at its leisure.
defaults write com.apple.sidebarlists favoriteservers -dict-add CustomListItems '( { Name = "whatever"; URL = "smb://server.example.com"; } )'
That said, the Finder still won't pick up the changes immediately, but it will once it's restarted. It might be sufficient to do killall -HUP Finder
or something like that. (That will probably just kill the Finder at which point it will be automatically restarted.) You could also do something like:
osascript -e 'tell app "Finder" to quit'
sleep 1
osascript -e 'tell app "Finder" to launch'
Mind you, only do this with the permission of the user. Killing the Finder when the user isn't expecting it would be very rude and has the potential for data loss.