Add user to admin group with Applescript

by on January 12, 2010 » Add the second comment.

Need a way for your team to easily make a network or local user an admin? Copy and paste the code below into Script Editor (Applescript Editor in 10.6) and save it as an application. This can be used before deploying a machine to the user, or after they’ve logged in.

(*
Add user to admin group
 
This script should not need any modification, unless you want to "brand" it. 
 
http://macadmincorner.com
*)
 
tell application "System Events"
	set shortName to name of current user
end tell
 
set userName to text returned of (display dialog "Enter the users shortname" default answer shortName)
 
do shell script "dseditgroup -o edit -a " & userName & " -t user admin" with administrator privileges
 
 
display dialog (do shell script "dscl . -read /Groups/admin users") with title "The following users are admins on this machine" buttons "Ok" default button 1

Find more like this: Mac, Scripting , , , ,


One Response to Add user to admin group with Applescript

Leave a Reply

Your email address will not be published. Required fields are marked *