Adding Server addresses into a policy

DDeleon
New Contributor

Hello All,

I once again turn to the JAMF Nation for some more guidance.

So, on a mac when you hit command K, you can enter in the server address.

Here's my question... is there a way to make this a policy and roll this out to end users? So everyone in the company will have the same server addresses.

Thank You

Darwin

2 REPLIES 2

scottb
Honored Contributor

The info is stored in:

~/Library/Preferences/com.apple.sidebarlists.plist

To read:  defaults read com.apple.sidebarlists favoriteservers
To write: defaults write com.apple.sidebarlists favoriteservers

You could create one with the servers you want and then use a FUT to install in all User's ~/Library/Preferences/ folder.

Or I'm sure a smarter guy/gal will give you a better solution though.

davidacland
Honored Contributor II
Honored Contributor II

As its an array you will probably need plist buddy. I think this post is what you are looking for:

https://jamfnation.jamfsoftware.com/discussion.html?id=5010

Each new entry has three elements:

/usr/libexec/PlistBuddy -c "Add :favoriteservers:CustomListItems:0 dict" ~/Library/Preferences/com.apple.sidebarlists.plist
/usr/libexec/PlistBuddy -c "Add :favoriteservers:CustomListItems:0:Name string afp://server1.company.com" ~/Library/Preferences/com.apple.sidebarlists.plist
/usr/libexec/PlistBuddy -c "Add :favoriteservers:CustomListItems:0:URL string afp://server1.company.com" ~/Library/Preferences/com.apple.sidebarlists.plist

You will need to add a "killall cfprefsd" at the start otherwise preference caching will trample all over it.

Hope this helps!