Category filter
Script to Fetch User Details on Mac
Use the below scripts to print details about the users on your Mac. You can also use the script to view the list of all users and fetch information like Unique ID ahead of creating a new user as no two users can share the same Unique ID.
Device admins can remotely run scripts on Macs managed with Hexnode using the Execute Custom Script action.
Scripting Language – Bash
File extension – .sh
Print list of all users
1 |
dscl . list /Users |
The Directory Service command-line utility or dscl
command can be used to create, read and manage Directory Service data. Since the users on the system are present on the ‘/Users’ directory, we can use the command to fetch the list of all users on the system.
Print list of UniqueIDs assigned to users
1 |
dscl . list /Users UniqueID |
Every user on the system has a Unique ID and while creating a new user, device admins might need to know the already allocated Unique IDs in order to assign a fresh ID for the new user.