Articles‎ > ‎

Apple Remote Desktop reset password applescript

posted Dec 23, 2008, 10:00 AM by Philip Rinehart   [ updated Dec 23, 2008, 10:01 AM by Greg Neagle ]
Written by Richard Glaser & James Reynolds   
Friday, 16 September 2005
If want to speed up the process of resetting your Apple Remote Desktop username & password rather than manually selecting each client and changing the username or password, here is a AppleScript that will automate the process.

To use this AppleScript, you need to turn on "Enable access for assistive devices" in System Preferences -> Universal Access -> Seeing. Next, launch "Remote Destkop" select a group of clients & select Get Info, run the AppleScript enter ARD username & password at the prompts and sit back and watch it work.

See script below...

-- Program      : ARD Reset Username & Password
-- Purpose      : Automate changing the username and password for connections
-- Based upon   : An AppleScript by Richard Glaser & James Reynolds
-- Revised      : 2005/09/15 <hkr> Initial version

tell application "Remote Desktop"
    set window_names to the name of (every window whose visible is true and name ends with "Info")
end tell

if window_names = {} then
    display dialog "You don't have any info windows open." buttons {"Ooops"} default button 1
end if

set ARD_user to the text returned of (display dialog "ARD Login:" default answer "username" with title "ARD Login")
set ARD_password to the text returned of (display dialog "ARD Password:" default answer "password" with title "ARD Password" with hidden answer)

tell application "System Events"
    tell process "Remote Desktop"
        repeat with this_window_name in window_names
            click button "Edit" of window this_window_name
            set value of text field 2 of group 1 of window this_window_name to ARD_user
            set value of text field 3 of group 1 of window this_window_name to ARD_password
            click button "Done" of window this_window_name
            click button 1 of window this_window_name
        end repeat
    end tell
end tell