Add user to admin group with Applescript

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
Bookmark and Share

Related posts:

  1. Migrate Local User to Domain Account
  2. Bind to OD Script & Add to Computer Group

Mac, Scripting -->

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

One Response to “Add user to admin group with Applescript”

Leave Comment

(required)

(required)