Category filter

Script to fetch the Apple IDs of users on Mac

Permitting Apple ID usage on the managed devices enables users to sign in to the device or access Apple services, including iCloud, Find My, etc. However, while allowing Apple ID usage, the admin would also like to determine how the users work with Apple IDs and associated services on the devices. For instance, the administrator wants to identify the Apple ID signed in by the user before turning on specific iCloud restrictions. It is helpful when the method is straightforward and can be performed remotely. This doc provides a script that lets you determine if the user has signed in to an Apple ID and, if yes, fetches it. The
Execute Custom Script
action from the Hexnode console lets you execute such customized scripts remotely across the devices.


The Sample Scripts provided below are adapted from third-party Open-Source sites.

Find if the device uses an Apple ID

The following script checks each user account on the device and determines if they are signed in to an Apple ID. Then, it returns an individual message for each user, either stating that the given user account does not use an Apple ID or specifying the signed-in Apple ID.


  • It is recommended to manually validate the script execution on a system before executing the action in bulk.
  • Hexnode will not be responsible for any damage/loss to the system on the behavior of the script.

  • Sample Script Repository