Skip to main content
Solved

Find computers using iCloud Drive


Forum|alt.badge.img+8
  • Valued Contributor
  • 70 replies

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..

Best answer by iJake

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
View original
Did this topic help you find an answer to your question?

9 replies

iJake
Forum|alt.badge.img+21
  • Contributor
  • 279 replies
  • Answer
  • November 3, 2016

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

Forum|alt.badge.img+8
  • Author
  • Valued Contributor
  • 70 replies
  • November 3, 2016

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!


iJake
Forum|alt.badge.img+21
  • Contributor
  • 279 replies
  • November 3, 2016

@danshaw Glad to help!


daniel_ross
Forum|alt.badge.img+18
  • Jamf Heroes
  • 186 replies
  • January 29, 2017

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


Forum|alt.badge.img+11
  • New Contributor
  • 14 replies
  • February 10, 2017

Works like a charm. Thank you, @iJake


Forum|alt.badge.img+12
  • Contributor
  • 45 replies
  • February 13, 2018

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.


Forum|alt.badge.img+7
  • Contributor
  • 12 replies
  • August 6, 2019

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


Forum|alt.badge.img+5
  • Contributor
  • 42 replies
  • September 5, 2019

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


Forum|alt.badge.img+5
  • New Contributor
  • 14 replies
  • September 5, 2019

@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.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings