Does anyone know of a good way to do this in an extension attribute or similar? I need to track down laptops that haven't yet been switched over to using AD accounts.
Determine if an account is a Mobile or Local Account
Best answer by ctangora
I wouldn't say that the local accounts can't go above 1000. I have a few users that tried tricking us into thinking they had AD accounts by changing their UID to be in the 10,000 range. I just changed a test account to 2900 and it seems to work as well.
This method (UID) will get you 99.9% of the people. You will have some of the advanced users that will always cause issues. You can list who is a directory account by looking for the "OriginalNodeName" in the DS.
List all directory accounts, if no accounts it returns nothing.
dscl . list /Users OriginalNodeName 2>/dev/null
List only the names of the directory accounts, if no accounts it returns nothing.
dscl . list /Users OriginalNodeName | awk '{print $1}' 2>/dev/null
If you are looking up a specific user, you could throw this into an if statement (as it will return nothing on a error)...
dscl . read /Users/username OriginalNodeName 2>/dev/null
... if the user is only a local account, this will return with nothing.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
