Find the Apple ID of the currently logged in user.
- 25 Dec 2023
- 1 Minute to read
- Print
- PDF
Find the Apple ID of the currently logged in user.
- Updated on 25 Dec 2023
- 1 Minute to read
- Print
- PDF
Article summary
Did you find this summary helpful?
Thank you for your feedback
The following Shell script helps IT Admins to see the Apple ID of the current logged in user on the managed Mac devices.
- Create a file on your desktop, for example, AppleID.sh and open it in a text editor like notepad++
- Copy the contents below to the file or click hereto download the file.Shell
#!/bin/bash for user in $(dscl . list /Users UniqueID | awk '$2 >= 500 {print $1}'); do userHome=$(dscl . read /Users/"$user" NFSHomeDirectory | sed 's/NFSHomeDirectory://' | grep "/" | sed 's/^[ \t]*//') appleid=$(dscl . readpl "${userHome}" dsAttrTypeNative:LinkedIdentity appleid.apple.com:linked\ identities:0:full\ name 2> /dev/null | awk -F'full name: ' '{print $2}') if [[ "${appleid}" == "" ]]; then echo "User:${user} has not signed in with an Apple ID" else echo "User:${user} is signed in with AppleID:${appleid}" fi done
- Once the script is successfully executed you will see the Apple ID of the current logged in user in the View Status report > Output tab.
- Follow our guide to upload & publish the Shell script using Scalefusion Dashboard.
Please note that to use the Shell scripts, the Scalefusion MDM Client Application must be installed on the device(s). Please follow our guide to publish and install the Scalefusion MDM Agent Application.
Notes:
- The scripts and their contents are sourced from various albeit authenticated Apple Developer communities and forums.
- Please validate the scripts on a test machine before deploying them on all your managed devices.
- Scalefusion has tested these scripts, however, Scalefusion will not be responsible for any loss of data or system malfunction that may arise due to the incorrect usage of these scripts.
Was this article helpful?