Remove iCloud Account from Macbooks

jhathcock
New Contributor III

We have profiles set up to disable iCloud in Settings for our student macbooks, but some have figured out how to add their accounts anyway via other apps tied into iCloud.  Is there a script that will force the removal of an iCloud account from a DEP device?  I tried some of the old ones from 5-6 years ago and they no longer function.

Second question, is there a way to detect what devices have iCloud accounts on them from Jamf Pro?

2 REPLIES 2

YanW
Contributor III

We restrict all built-in apps that can log into iCloud. I don't think you can force log out. We only had 1 student logged in due to the profile and Ventura issue. I just lock the student's laptop so they have to come to us to unlock and log out their iCloud account. 

Forgot where I got this EA from.

#!/bin/sh

loggedInUser=$(stat -f%Su /dev/console)

icloudaccount=$( defaults read /Users/$loggedInUser/Library/Preferences/MobileMeAccounts.plist Accounts | grep AccountID | cut -d '"' -f 2)

if [ -z "$icloudaccount" ] 
then
    echo "<result>Null</result>"
else
    echo "<result>$icloudaccount</result>"
fi

 

jhathcock
New Contributor III

This helps.  Thanks