what is the current Apple ID on the Mac?

Moe_Halabia
New Contributor II

Hi all
Is there any way that we can find out what is the current Apple ID on the Mac ??

1 ACCEPTED SOLUTION

stevewood
Honored Contributor II

@mo.halabia

I use the following EA to grab the user signed into iCloud:

#!/bin/sh
## Get logged in user
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>No Accounts Signed In</result>"
else
    echo "<result>$icloudaccount</result>"
fi

View solution in original post

2 REPLIES 2

stevewood
Honored Contributor II

@mo.halabia

I use the following EA to grab the user signed into iCloud:

#!/bin/sh
## Get logged in user
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>No Accounts Signed In</result>"
else
    echo "<result>$icloudaccount</result>"
fi

View solution in original post

Moe_Halabia
New Contributor II

@stevewood

thanks a lot works just fine