Managing Finder "view" settings

benshawuk
New Contributor III

Has anyone had any luck managing these settings with configuration profiles?
I'm attempting to manage the Finder setting "Calculate All Sizes", in order to globally turn it off on OS X clients.

I'm having success when attempting to manage more standard Finder settings (such as show hard disks on desktop etc.) but not when trying to manage these view settings (nothing seems to apply). Is this even possible to reliably enforce?

external image link

external image link

I'm using mcxtoprofile to create the configuration profile from the above plist.
Should com.apple.finder preferences be applied at computer or user level? And should it be once, often, or always?
I've tried various combinations with no success. This is on Yosemite clients (though it would be great if it also worked on earlier OSes).

Many thanks for any tips/advice.

9 REPLIES 9

RobertHammen
Valued Contributor II

I would think you'd want to set it to User level. Once = set it once and let the user change, Always = user can't change.

Are these local users or users from AD/another directory service? There have been some issues with managed prefs not applying to users from a directory system:

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

benshawuk
New Contributor III

Thanks Robert. Unfortunately that still doesn't work. The standard "Show hard drives on desktop" etc. preferences work (as can be seen at the top of my first screen shot), but not the "calculate all sizes" settings (as at the bottom of the first screen shot).

These are AD user accounts with mobile accounts. Perhaps it's a Yosemite bug as per the thread you referenced.

RobertHammen
Valued Contributor II

What if you script the changes with defaults write?

As a test, log in as one of the AD/mobile account users and run the script, then killall cfprefsd (if not in the script) and check the preference setting.

Could always have a script/launchd combo which runs at user login and sets the values... could add logic so it checks for the presence of a file and only runs once (Once), or checks the values and resets them if changed (Always)...

benshawuk
New Contributor III

Thanks. Good idea, but I'm not sure you can use defaults write to edit nested keys within a plist file..
And Plistbuddy is no longer reliable due to the way OS X now caches (and overwrites) it's preferences.
I even attempted the below Applescript out of desperation but unfortunately it just screws up the plist file and leaves it empty and broken:

tell application "System Events" set finderPrefsFile to property list file "/Users/myname/Library/Preferences/com.apple.Finder.plist" tell finderPrefsFile tell property list item "StandardViewSettings" tell property list item "ListViewSettings" set value of property list item "calculateAllSizes" to NO end tell end tell end tell end tell

I'd be fascinated to know if anyone out there is actually successfully managing these view preferences using any method whatsoever (other than having a correctly formatted .plist in a default profile prior to the user profile being created).
It's a real shame that the config profile method doesn't seem to work.

bentoms
Honored Contributor III
Honored Contributor III

@benshawuk you might want to look at a bash script that sets the values via the defaults command.

Or, maybe setup the plist as you want & create a custom configuration profile from the JSS. That may either enforce the settings, or set them once per login.

benshawuk
New Contributor III

Thanks Bentoms, but the problem is "defaults write" isn't suited to editing subkeys of plist files.
I think this is why plistbuddy has been so popular up until the new method of OS X caching preferences with cfprefsd etc. (which now renders it useless for modifying "live" plists such as com.apple.finder)

Replacing the com.apple.finder.plist file is probably the way to go, however this is problematic in how inflexible it is: Any user modifications to the finder: icon sizes, text size, view settings etc. will be completely overwritten.

I'm amazed at how impossible this simple management requirement actually is.
If anyone else has any other suggestions, I'm all ears...

benshawuk
New Contributor III

Wow, just discovered your article here that might provide an answer my question:
https://macmule.com/2014/02/07/mavericks-preference-caching/

Is the Python method the best here?
Or do you know if the "defaults read" after plistbuddy modifying works reliably? (as mentioned in the comments below the article)

It certainly feels uncomfortable to killall cfprefsd as a "solution"..

andrewh
New Contributor II

@benshawuk Any luck getting calculate all sizes managed in Finder? Trying to figure out what the best way to do this would be.

benshawuk
New Contributor III

Hi Andrew,

It was a bit of a kludge to be honest, but this seemed to work eventually.
The script needs to be applied at user/GUI level (not root in the background) periodically, whilst the user is logged in. (I don't actually use Casper so I'm not exactly sure how this is done within the Jamf environment):

cuser=$(#however you prefer to get the current user/home info#)

/usr/libexec/PlistBuddy "/Users/$cuser/Library/Preferences/com.apple.finder.plist" -c 'Delete "StandardViewSettings:ExtendedListViewSettings:calculateAllSizes" bool'
/usr/libexec/PlistBuddy "/Users/$cuser/Library/Preferences/com.apple.finder.plist" -c 'Delete "StandardViewSettings:ListViewSettings:calculateAllSizes" bool'
/usr/libexec/PlistBuddy "/Users/$cuser/Library/Preferences/com.apple.finder.plist" -c 'Delete "SearchViewSettings:ExtendedListViewSettings:calculateAllSizes" bool'
/usr/libexec/PlistBuddy "/Users/$cuser/Library/Preferences/com.apple.finder.plist" -c 'Delete "SearchViewSettings:ListViewSettings:calculateAllSizes" bool'
/usr/libexec/PlistBuddy "/Users/$cuser/Library/Preferences/com.apple.finder.plist" -c 'Delete "ComputerViewSettings:ListViewSettings:calculateAllSizes" bool'
/usr/libexec/PlistBuddy "/Users/$cuser/Library/Preferences/com.apple.finder.plist" -c 'Delete "ComputerViewSettings:ExtendedListViewSettings:calculateAllSizes" bool'; exit 0; fi

Delete FK_StandardViewSettings attributes and create with calculateAllSize set to false

/usr/libexec/PlistBuddy "/Users/$cuser/Library/Preferences/com.apple.finder.plist" -c 'Delete "FK_StandardViewSettings:ListViewSettings:calculateAllSizes" bool'
/usr/libexec/PlistBuddy "/Users/$cuser/Library/Preferences/com.apple.finder.plist" -c 'Delete "FK_StandardViewSettings:ExtendedListViewSettings:calculateAllSizes" bool'
/usr/libexec/PlistBuddy "/Users/$cuser/Library/Preferences/com.apple.finder.plist" -c 'Add "FK_StandardViewSettings:ListViewSettings:calculateAllSizes" bool false'
/usr/libexec/PlistBuddy "/Users/$cuser/Library/Preferences/com.apple.finder.plist" -c 'Add "FK_StandardViewSettings:ExtendedListViewSettings:calculateAllSizes" bool false'

Delete calculateAllSizes attribute for StandardViewSettings, SearchViewSettings & SettingsComputerViewSettings

/usr/libexec/PlistBuddy "/Users/$cuser/Library/Preferences/com.apple.finder.plist" -c 'Delete "StandardViewSettings:ExtendedListViewSettings:calculateAllSizes" bool'
/usr/libexec/PlistBuddy "/Users/$cuser/Library/Preferences/com.apple.finder.plist" -c 'Delete "StandardViewSettings:ListViewSettings:calculateAllSizes" bool'
/usr/libexec/PlistBuddy "/Users/$cuser/Library/Preferences/com.apple.finder.plist" -c 'Delete "SearchViewSettings:ExtendedListViewSettings:calculateAllSizes" bool'
/usr/libexec/PlistBuddy "/Users/$cuser/Library/Preferences/com.apple.finder.plist" -c 'Delete "SearchViewSettings:ListViewSettings:calculateAllSizes" bool'
/usr/libexec/PlistBuddy "/Users/$cuser/Library/Preferences/com.apple.finder.plist" -c 'Delete "ComputerViewSettings:ListViewSettings:calculateAllSizes" bool'
/usr/libexec/PlistBuddy "/Users/$cuser/Library/Preferences/com.apple.finder.plist" -c 'Delete "ComputerViewSettings:ExtendedListViewSettings:calculateAllSizes" bool'

You may want to take steps to back up the original file first too:

if [ ! -f /Users/$cuser/Library/Preferences/com.apple.finder.plist.backup ]; then echo "Finder plist backup not found. Creating..." cp /Users/$cuser/Library/Preferences/com.apple.finder.plist /Users/$cuser/Library/Preferences/com.apple.finder.plist.backup
else echo "Finder plist already backed up."
fi

Good luck. Shame Apple make these sort of things such a PIA to manage.
My next fun task is always showing the computer object in the "devices" menu of the sidebar... :(