View the users iCloud account username?

hakan_sjogren
New Contributor

Is there any way that we in Jamf Pro can display which appleID the user has chosen?

1 REPLY 1

djdavetrouble
Contributor III
#!/bin/bash

for user in $(ls /Users/ | grep -v Shared); do
    if [ -d "/Users/$user/Library/Application Support/iCloud/Accounts" ]; then
        Accts=$(find "/Users/$user/Library/Application Support/iCloud/Accounts" | grep '@' | awk -F'/' '{print $NF}')
        iCloudAccts+=(${user}: ${Accts})
    fi
done

echo "<result>$(printf '%s
' "${iCloudAccts[@]}")</result>"