Skip to main content

I'd like to start preparing to upgrade our computers to Sierra and one of the major no no's is allowing the user to enable iCloud Desktop & Documents. Currently there is not a way (that I know of) to turn this off, but keep iCloud drive off. While I don't think that many of our users use iCloud Drive, I would like to set up an EA that could tell me how many users currently use it. Because I will be completely turning iCloud Drive off when users upgrade.

The Plist that shows this is MobileMeAccounts.plist in ~/Library/Preferences/

The trouble is how to identify that it is enabled via a script. The key that shows if it is enabled is above the string. I can't seem to figure out how to look for it. Or maybe there is an easier way!

     <dict>
        <key>Enabled</key>
        <false/>
        <key>Name</key>
        <string>MOBILE_DOCUMENTS</string>
        <key>ServiceID</key>
        <string>com.apple.Dataclass.Ubiquity</string>
        <key>apsEnv</key>
        <string>production</string>
        <key>authMechanism</key>
        <string>token</string>
        <key>iCloudHomeShouldEnable</key>
        <false/>
        <key>url</key>
        <string>https://p48-ubiquity.icloud.com:443</string>
        <key>wsUrl</key>
        <string>https://p48-ubiquityws.icloud.com:443</string>  
     </dict>

I realize that this might be a tough question, but I am hoping someone is better than I am at using pListBuddy, awk, grep, etc..

I wrote this EA for us to track iCloud Drive enablement

#!/bin/bash

iCloudDrivePath="/Library/Mobile Documents/com~apple~CloudDocs"

grabConsoleUserAndHome()
{
currentUser=$(stat -f %Su "/dev/console")
homeFolder=$(dscl . read "/Users/$currentUser" NFSHomeDirectory | cut -d: -f 2 | sed 's/^ *//'| tr -d '
')
  case "$homeFolder" in  
     * * )
           homeFolder=$(printf %q "$homeFolder")
          ;;
       *)
           ;;
esac
}

grabConsoleUserAndHome

if [[ "$currentUser" == "root" ]]
    then
        exit
fi

if [[ -e "$homeFolder""$iCloudDrivePath" ]]
    then
        echo "<result>true</result>"
    else
        echo "<result>false</result>"
fi

exit 0

Awesome! I didn't even think to go the route of looking for the folder rather then trying to parse this plist. Works like a charm! Thanks!


@danshaw Glad to help!


@iJake this absolutely perfect! Wish we had some way to award points for solutions (Suggesting it for the site features).


Works like a charm. Thank you, @iJake


Thanks for posting this script @iJake On a more granular level, is there a way to find out if a user has the Desktop & Documents folder option enabled for iCloud drive? I'm not sure what plist that preference is being written to.


how are you guys dealing with users that already have icloud drive enabled more of what do you guys do with their data?


Anyone ever find a way to find out which users have Desktop and Documents folders being actively synced to iCloud drive?


@macmanmk, @alexyu650 & @techmchs,

I modified a script which was originally found elsewhere here on JamfNation that does just this. See near the bottom of the page, here:

Search criteria for computers that have Desktop and Documents in the cloud?

So far, it's been working 100% in my environment.