.DS_Store file suppression configuration profile

nkalister
Valued Contributor

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?

1 ACCEPTED SOLUTION

nkalister
Valued Contributor

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

View solution in original post

6 REPLIES 6

bentoms
Release Candidate Programs Tester

instead of string, try boolean

nkalister
Valued Contributor

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.

nkalister
Valued Contributor

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

bentoms
Release Candidate Programs Tester

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

Matt
Valued Contributor

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)!!!

nkalister
Valued Contributor

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