Policy to enable, show "connected servers" in Finder on 10.8.x?

Castro
New Contributor III

Hello,

Since 10.8 seems to have this setting disabled by default, and we'd like for our users to see the drives we're mapping on their desktop- does anyone know of a way to enable this settings (show connected servers) via a policy? Thank you.

8 REPLIES 8

Chris
Valued Contributor

If you're using Casper MCX, you can use the "Mounted Servers On Desktop" Template in the "com.apple.finder" section.

Otherwise, ```
defaults write com.apple.finder ShowMountedServersOnDesktop -bool TRUE
``` should do the trick.

Castro
New Contributor III

Thank you for the reply. When I run this command (defaults write com.apple.finder ShowMountedServersOnDesktop -bool TRUE) from Casper Remote, against a test machine, the option is not selected in the Finder preferences. I tried a reboot, no change. Any thoughts? I'm just trying to make sure that all users (new, old) on the machines have this setting enabled by default. Thanks again!

Chris
Valued Contributor

Casper runs the command as root, so it changes the setting for root.
If you want to use the defaults command over MCX, you need to loop through existing users and the User Template(s).
Something like

#!/bin/sh

for i in $(/bin/ls /Users | sed -e '/Shared/d');

do

defaults write /Users/"${i}"/Library/Preferences/com.apple.finder ShowMountedServersOnDesktop -bool TRUE

done

for USER_TEMPLATE in "/System/Library/User Template"/*

do

defaults write "${USER_TEMPLATE}"/Library/Preferences/com.apple.finder ShowMountedServersOnDesktop -bool TRUE

done

exit 0

(Someone please improve/correct my scripting!)

Castro
New Contributor III

Hm.. I created a script with the above text, but it didn't work. Thanks for your help!

jstrauss
Contributor

I found the following AppleScript that seems to work for me.

tell application "System Events"
    tell process "Finder"
        set frontmost to true
        click menu item "Preferences…" of menu 1 of menu bar item "Finder" of menu bar 1
        click button "General" of tool bar 1 of window "Finder Preferences"
        if value of checkbox "Connected servers" of window "Finder Preferences" is 0 then
            click checkbox "Connected servers" of window "Finder Preferences"
        end if
    end tell
end tell

Chris_Hafner
Valued Contributor II

From another thread http://www.princeton.edu/~jcjb/docs/osx_imaging/

kateswist
New Contributor

Hello,

I know this is an older post, but I have jstrauss's script written and confirmed that it can run. How do I attach this script to a JSS policy so I can run it on a group of computers?

Also is there a way to close the finder preferences dialog box so the user doesn't have to manually close it?

I had to check "enable access for assistive devices" in my preferences in order for this script to run correctly. I assume that I will have to do that on all of the machines I want to deploy this script to? Is there a way to set that as a default in a JSS policy?

Katie

mm2270
Legendary Contributor III

@kateswist - there shouldn't be a need to do this from an AppleScript. Defaults works just fine, as does Managed Preferences(MCX) and I suspect, though not sure, that Configuration Profiles could also do this.

If you want to affect the settings for the logged in user, there are a few different ways to do it.

You could simply enter this in the Run Command field of a policy:

/usr/bin/defaults write /Users/$(ls -l /dev/console | awk '{print $3}')/Library/Preferences/com.apple.finder ShowMountedServersOnDesktop -bool TRUE

This just gets the logged in user's account name and plugs it into the path to the plist file to affect. You may get unexpected results or failures if no account is logged in, but otherwise should work.

I'd look also at Managed Preferences (MCX) if you happen to be using them. Create a new Managed Preference and choose Create from template. turn down the "com.apple.finder" heading and look for "Mounted Servers On Desktop" and click Create to set it up.
For something like this, I'd recommend setting it to "User level at Next login only" rather than "System Level Enforced", but that's a matter of preference and your environments needs.