This script will get the users in the admin group:
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
return admin_users
And this will get the sudoers from the sudoers file:
set sudoers_all to paragraphs of (do shell script "cat /etc/sudoers" with administrator privileges)
set sudoers to {}
repeat with this_para in sudoers_all
set this_para to (contents of this_para)
try
if ((character 1 of this_para) is not in {"#", "%", "+"}) then set end of sudoers to word 1 of this_para
end try
end repeat
return sudoers
Is there a way to get the sudoers using niutil without having to enter a password?
Jon