Skip to main content
Answer

.DS_Store file suppression configuration profile

  • September 11, 2012
  • 6 replies
  • 15 views

Forum|alt.badge.img+19

Hey there jamfnation, I've always used MCX to suppress the creation of .DS_Store files on network shares in the past, and I've converted the MCX I used to use to a custom setting in a configuration profile for 10.8, but it does not appear to work- clients ARE creating those files on network shares.
running the defaults command in terminal

defaults write com.apple.desktopservices DSDontWriteNetworkStores true

does work, so I'm wondering if I've messed up the translation to a profile in some way.
The profile setting i'm using is:

Preference Domain: com.apple.desktopservices
Key: DSDontWriteNetworkStores
Type: String
Value: true

This is embedded in a device (NOT a user) profile.
Anyone have a suggestion for managing this setting on 10.8?

Best answer by nkalister

I'm going to use the defaults command to handle this for now, i think. I've decided to use Rich Trouton's script as an catchall for anything I used to do in MCX that can't be done with config profiles for now.

#!/bin/sh

# lets do things that config profiles can't!
if [ `sw_vers -productVersion | awk -F. '{ print $2 }'` -ge 7 ]
then
    mv /System/Library/CoreServices/Setup Assistant.app/Contents/SharedSupport/MiniLauncher /System/Library/CoreServices/Setup Assistant.app/Contents/SharedSupport/MiniLauncher.backup
    for USER_TEMPLATE in "/System/Library/User Template"/*
    do
        defaults write "${USER_TEMPLATE}"/Library/Preferences/com.apple.SetupAssistant DidSeeCloudSetup -bool TRUE
        defaults write "${USER_TEMPLATE}"/Library/Preferences/com.apple.desktopservices DSDontWriteNetworkStores true
    done

    for USER_HOME in /Users/*
    do
        USER_UID=`basename "${USER_HOME}"`
        if [ ! "${USER_UID}" = "Shared" ]
        then
            if [ ! -d "${USER_HOME}"/Library/Preferences ]
            then
                mkdir -p "${USER_HOME}"/Library/Preferences
                chown "${USER_UID}" "${USER_HOME}"/Library
                chown "${USER_UID}" "${USER_HOME}"/Library/Preferences
            fi
            if [ -d "${USER_HOME}"/Library/Preferences ]
            then
                defaults write "${USER_HOME}"/Library/Preferences/com.apple.SetupAssistant DidSeeCloudSetup -bool TRUE
                defaults write "${USER_HOME}"/Library/Preferences/com.apple.desktopservices DSDontWriteNetworkStores true
                chown "${USER_UID}" "${USER_HOME}"/Library/Preferences/com.apple.SetupAssistant.plist
                chown "${USER_UID}" "${USER_HOME}"/Library/Preferences/com.apple.desktopservices.plist
            fi
        fi
    done
fi

6 replies

bentoms
Forum|alt.badge.img+35
  • Hall of Fame
  • September 11, 2012

instead of string, try boolean


Forum|alt.badge.img+19
  • Author
  • Contributor
  • September 11, 2012

I'll give it a try. i'm using a spindle-disk based mini for testing, so it'll be about an hour before I have results.


Forum|alt.badge.img+19
  • Author
  • Contributor
  • September 11, 2012

no go on the boolean.
I may just go with a defaults write script at first boot.


bentoms
Forum|alt.badge.img+35
  • Hall of Fame
  • September 11, 2012

yea it's infuriating.. so config profiles work, some mcx.. some require scripting..


Forum|alt.badge.img+20
  • Valued Contributor
  • September 11, 2012

Agree Ben. I really was hoping Config Profiles would be an end all be all since it seems so versatile on paper. Of course everything works on Powerpoint (or Keynote)!!!


Forum|alt.badge.img+19
  • Author
  • Contributor
  • Answer
  • September 12, 2012

I'm going to use the defaults command to handle this for now, i think. I've decided to use Rich Trouton's script as an catchall for anything I used to do in MCX that can't be done with config profiles for now.

#!/bin/sh

# lets do things that config profiles can't!
if [ `sw_vers -productVersion | awk -F. '{ print $2 }'` -ge 7 ]
then
    mv /System/Library/CoreServices/Setup Assistant.app/Contents/SharedSupport/MiniLauncher /System/Library/CoreServices/Setup Assistant.app/Contents/SharedSupport/MiniLauncher.backup
    for USER_TEMPLATE in "/System/Library/User Template"/*
    do
        defaults write "${USER_TEMPLATE}"/Library/Preferences/com.apple.SetupAssistant DidSeeCloudSetup -bool TRUE
        defaults write "${USER_TEMPLATE}"/Library/Preferences/com.apple.desktopservices DSDontWriteNetworkStores true
    done

    for USER_HOME in /Users/*
    do
        USER_UID=`basename "${USER_HOME}"`
        if [ ! "${USER_UID}" = "Shared" ]
        then
            if [ ! -d "${USER_HOME}"/Library/Preferences ]
            then
                mkdir -p "${USER_HOME}"/Library/Preferences
                chown "${USER_UID}" "${USER_HOME}"/Library
                chown "${USER_UID}" "${USER_HOME}"/Library/Preferences
            fi
            if [ -d "${USER_HOME}"/Library/Preferences ]
            then
                defaults write "${USER_HOME}"/Library/Preferences/com.apple.SetupAssistant DidSeeCloudSetup -bool TRUE
                defaults write "${USER_HOME}"/Library/Preferences/com.apple.desktopservices DSDontWriteNetworkStores true
                chown "${USER_UID}" "${USER_HOME}"/Library/Preferences/com.apple.SetupAssistant.plist
                chown "${USER_UID}" "${USER_HOME}"/Library/Preferences/com.apple.desktopservices.plist
            fi
        fi
    done
fi