Detecting admin status

How does one know whether a user is admin or not using AppleScript? Thanks.

While we’re at it, is it possible to get the default shell of a user? It’s stored in Netinfo but I don’t know where the database is. Thx!

This will answer the first part of your question and steer you in the right direction for the follow-up:

set current_user to (do shell script "whoami")

set admin_users to (do shell script "/usr/bin/niutil -readprop . /groups/admin users")
tell (a reference to AppleScript's text item delimiters)
	set {old_atid, contents} to {contents, " "}
	set {admin_users, contents} to {text items of admin_users, old_atid}
end tell
if current_user is in admin_users then
	return "Congratulations, " & current_user & ", you're an admin."
else
	return "Sorry, " & current_user & ", you're not an admin."
end if

Jon

Thanks a lot - this is exactly what I want!