Scripting ARD

I am working on scripting Apple Remote Desktop to send a Unix script to a group of Macs.
This is what I have so far
tell application "Remote Desktop"
set theListofLists to name of every computer list --get all exsisting lists
set theDestinationLists to choose from list theListofLists with title ¬
"Computer Lists" with prompt "Pick the computer list(s) you want the selected computers to be members of" with multiple selections allowed
do shell script ¬
"softwareupdate -l"
(display dialog (result)) delay --so you'll know the script is through running
--Input Update
set thecommand to text returned of ¬
(display dialog "Run Script:" default answer "")
do shell script thecommand with administrator privileges
end tell
How or what is a script to add to have the results be exported to a file?

What might I have wrong in the top part that will not let the script run?
You're using my example where I use theComputers as the list name:
set theResult to (execute myTask on theComputers)
However, theComputers is not defined in your version of the script.
You do define theDestinationLists to store the name of the list you want to apply the script do, but you don't actually get that list at any point.
Your task is complicated by the fact you allow the user to select multiple lists to run the script on. As a result you will have to iterate through the selected lists, running the script in turn.
The other problem you have is that even after you get the right list, your script will fail anyway.
set theScript to "List Updates"
All this will do is return a 'List: command not found' because 'List' is not a valid Unix command.
In order to work your theScript variable has to be a valid shell command.
set theListofLists to {} --I like to make sure of things
tell application "Remote Desktop"
set theListofLists to name of every computer list --get all exsisting lists
set theDestinationLists to choose from list theListofLists with title ¬
"Computer Lists" with prompt "Pick the computer list(s) you want the selected computers to be members of" with multiple selections allowed
set theScript to "date" -- or some other valid UNIX command here
set myTask to (make new send unix command task with properties {script:theScript, user:"root"})
repeat with eachList in the DestinationLists
  set theComputers to computer list eachList -- iterate through the lists selected by the user
  set theResult to (execute myTask on theComputers)
  -- do something with theResult
end repeat
end tell

Similar Messages

  • Change ARD settings with bash script?

    Hello my fellow friends.
    First i am sorry for my bas English but hope you survive.
    I was wondering if it was possible to write a script that activated and deactivated ard?
    I looked in Controlpanel -> shared and its a option to stop or start a service so it must be possible true terminal or?
    Is there anyone that can point me in the right direction?
    Thanks.

    Thanks.
    Something like the page you linked to was what i needed .
    But i did figure out how to ask the client for premission to remote controll them so the problem solved itself..
    Anyway, thanks Dave.

  • Pushing out a script to run via ARD

    I have the following script I am running into two issues with
    1)  Instead of running it as root, can we run as a member of the admin group.
    2)  Can this be pushed out via ARD?
    #!/bin/bash
    #This script needs to run as root
    ROOT_UID=0
    if [[ $UID -ne $ROOT_UID ]]; then
    echo "YOU MUST BE ROOT TO RUN THIS SCRIPT"
    exit 1
    fi
    OLD="<string>The owner or any administrator can unlock the screensaver.<\/string>"
    NEW="<string>(Use SecurityAgent.) The owner or any administrator can unlock the screensaver.<\/string>"
    cp /private/etc/authorization /tmp/auth.tmp
    sed "s/$OLD/$NEW/" /tmp/auth.tmp > /tmp/authorization
    mv /private/etc/authorization /private/etc/authorization.previous
    mv /tmp/authorization /private/etc/authorization
    rm /tmp/auth.tmp

    Do not remove the "root user reference" from the script. Without "the reference" the script will place a modified authorization file in the /tmp directory. To modify the /private/etc/authorization file you must be root or an admin user with the proper authorization (You would use sudo in the shell environment). Here's a safer and cleaner version of that script->
    #!/bin/bash
    OLD="<string>The owner or any administrator can unlock the screensaver.<\/string>"
    NEW="<string>(Use SecurityAgent.) The owner or any administrator can unlock the screensaver.<\/string>
    # use sed to make a backup of the original file then edit the file in place
    /usr/bin/sed -i.previous "s/$OLD/$NEW/" /private/etc/authorization

  • Does anyone know the apple script or unix command in ARD that allows me to send keystroke commands to computers on my ARD network ? thanks !

    I am trying to cue computers through keystroke commands using ARD
    I want to know a unix shell or script command to hit keystrokes on my ARD machines.
    EXAMPLE... I want machine X  to press the letter K.
    I am also wondering if you can send multiple commands doing this , multiple keystrokes with built in delays
    Thank you

    Welcome,
    I use the "System Events" handler, e.g.:
              tell application "System Events" to delay 5.5
              tell application "System Events" to keystroke "K"
              tell application "System Events" to delay 0.5
              tell application "System Events" to keystroke return
    Regards,
    Shawn

  • Can this script be converted to a UNIX command for ARD?

    First I'd like to thank "Neil" again for providing the script below:
    set the_versions to (do shell script "mdls -name kMDItemVersion /Applications/Microsoft\\ Office\\ 2011/Microsoft\\ Excel.app")
    set the_versions to the_versions & return & (do shell script "mdls -name kMDItemVersion /Applications/Adobe\\ Reader.app")
    set the_versions to the_versions & return & (do shell script "mdls -name kMDItemVersion /Applications/Safari.app")
    set the_versions to the_versions & return & (do shell script "mdls -name kMDItemVersion /Applications/Google\\ Chrome.app")
    set the_versions to the_versions & return & (do shell script "mdls -name kMDItemVersion /Applications/Adobe\\ Acrobat\\ X\\ Pro/Adobe\\ Acrobat\\ Pro.app")
    set the_versions to the_versions & return & (do shell script "SW_vers")
    Output for this script yields exactly what I requested in the thread.  Ex:
    "kMDItemVersion = \"14.4.1\"
    kMDItemVersion = \"11.0.07\"
    kMDItemVersion = \"7.0.4\"
    kMDItemVersion = \"35.0.1916.114\"
    kMDItemVersion = \"10.1.10\"
    ProductName:          Mac OS X
    ProductVersion:          10.9.3
    BuildVersion:          13D65"
    I'd like to be able to run this command (or a variation) in Apple Remote Desktop (ARD) remotely, and as a UNIX command in order to generate a similar ARD report if possible.  Even better, I'd like the report to include the Application name and I'd like it to not to halt if an Application isn't present. My guess is that functionality like this for ARD would help a LOT of ARD Administrators because it would seem that the only way to do anything similar is to derive the metadata piecemeal (machine by machine) or end up having to wade through a ton of unwanted content using a full System Report...  Thanks.

    Forum software NOW prevents posting complete shell scripts. You'll have to piece together the code.
    First build an array of the applications that you are looking for in this form. Note; I truncated the applications.
    apps=( "/Applications/Microsoft Office 2011/Microsoft Excel.app" "/Applications/Adobe Reader.app" "/Applications/Safari.app" )
    Next loop thru the array
    for i in "${apps[@]}"; do
         printf "%s: %s\n" "$i" "$(mdls -name kMDItemVersion "$i")"
    done
    If you want to create a report then change the above loop to the following
    for i in "${apps[@]}"; do
         printf "%s: %s\n" "$i" "$(mdls -name kMDItemVersion "$i")"
    done > app_report.txt
    sw_vers >> app_report.txt
    Message was edited by: Mark Jalbert

  • ARD 3: Saving tasks as Apple Script

    I'm trying to cut out some repetitive tasks with Apple Remote Desktop 3 by using Automator. I use a number of tasks on a daily basis with my network of computers. I'd like to save the tasks as Automator Scripts or Apple Scripts so that other network administrators can perform these same tasks. I use the "save task" feature of ARD 3, and I know that I have limited functionality within Automator. If I could just save my tasks as Apple Script, the I could just program Automator to run the scripts - I could even get iCal to do it for me!
    Thanks,
    Woody Adams

    Here are a few:
    http://www.automator.us/ard/
    You might also find this article helpful:
    Creating Automator Actions for Apple Remote Desktop

  • Quick April Fools Day help--I need an ARD script to change the screensaver

    I set up all the machines I manage to have a screensaver that looks like a broken LCD screen. Pushed it out with ARD3 and it's installed on everyones machine. I just need help sending a script to change the default screensaver to be the broken screen. I've no idea how to complete this. Can anyone help?

    I don't know how to change it, but if you have ARD you can run it:
    /System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app /Contents/MacOS/ScreenSaverEngine -module ScreenSaverName

  • ARD Login Script Problem

    Hey there.
    I have a Mac lab that I am controlling with ARD. I know you can use the following UNIX script to login..
    osascript <<EndOfMyScript
              tell application "System Events"
                        keystroke "USERNAME"
                        keystroke tab
                        delay 0.5
                        keystroke "PASSWORD"
                        delay 0.5
                        keystroke return
              end tell
    EndOfMyScript
    ... However, my problem is that, for various reasons, the logins are set to choose from a list of accounts, not to enter the username. In other words, after the machine boots up, the user chooses the name of the account and then is prompted for the password.
    Can this script be modified to select a user or is there another way to script it?
    Thanks in advance.
    Adam

    > "Andrew Knoke" <[email protected]> wrote in message
    > news:typvh.9628$[email protected]..
    >
    > Also is there a way you can say in a login script to have users in a group
    > NOT get a map drive. In my example users in group would not get the H:
    > drive.
    >
    >
    > map root u:=%HOME_DIRECTORY
    >
    > If member of "small group.home" Then
    > goto five
    > end
    >
    > map root h:=sever\vol1:shared
    >
    > :five
    If not member of ".smallgroup.home" then
    map root h:=sever\vol1:shared
    End
    AZC

  • OSA script help in ARD...mouse click

    Hello,
    Lets say I want to use ARD (3.6.1) from my macbook air to click on a specific part of the screen on a 10.7.5 mac air. 
    I have found this osascript but it does not work. Lets say I want it to click at {330,220} in Pages.
    osascript -e 'tell application "System Events" to tell process "Directory Access" to click at {x,y}'
    I have tried changing "Directory Access" to the program I am running, "Pages" but that does not work. I am also running command as root.
    Any suggestions?

    If you google around, you can probable find allot of unix scripts out there to do most of what you can do in Directory Access. (enable root, enable/bind to a directory service, map attributes, extra) and they would be faster and more reliable then trying to perform that action at the finder level with emulate mouse clicks.
    FYI Not all process support the to click at funtion of applescript.
    Another option some times is to script actions by the GUI elements which isn't relient on the window being in exactly the right spot to work. BUT again it's easier to do allot of this stuff at the unix/command base level.
    What are you trying to do with Directory Access?
    If you want to use applescript, have you tried some thing you know should work like:
    activate application "AppleScript Editor"
    tell application "System Events" to tell process "AppleScript Editor" to click at {0, 0}

  • ARD Login script doesn't work with similar usernames

    We have a lab of Macs all of which have two accounts whose usernames start with the same characters (rms and rmsadmin). There are times when we would like to be able to log on to all the computers simultaneously as the rmsadmin user with ARD. Because both of the usernames start with the same three characters, when the following commands are sent via ARD, the login process defaults to selecting the student account (rms) and won't log in as rmsadmin:
    osascript -e 'tell application "System Events" to keystroke "rmsadmin"'; \
    osascript -e 'tell application "System Events" to keystroke return'; \
    osascript -e 'tell application "System Events" to delay 0.5'; \
    osascript -e 'tell application "System Events" to keystroke "password"'; \
    osascript -e 'tell application "System Events" to delay 0.5'; \
    osascript -e 'tell application "System Events" to keystroke return'
    Anyone have a solution to this?
    Thanks in advance for taking the time to read this and giving it some thought.
    Peggy
    Xserve PowerPC G4, MacBook Pro, PowerBook, etc.   Mac OS X (10.4.8)  

    Since we do have the same problem but also some additional infos I bump this thread in the hopes of getting some answers.
    The login script does run, but unfortunatly only when I start it manually. It does not run during login.
    The only purpose of the script is to map some drives and it works fine under XP. Where else can I find infos about the problem?
    Our script looks like that:
    On Error resume next  
    Set objADSystemInfo = CreateObject("ADSystemInfo")  
    Set objUser = GetObject("LDAP://" & objADSystemInfo.UserName)  
    strDn = objUser.Get("distinguishedName")  
    strSam = objUser.Get("sAMAccountName")  
    strCn = objUser.Get("cn")
    Set colGroups = objUser.Groups  
    Pos = Instr(strDn,"OU=")  
    if Pos = 0 then  
        strOu = "" 
    else  
        strOu = Mid(strDn,Pos+3,2)  
    end if  
    Set objNetwork = CreateObject("WScript.Network")   
    objNetwork.MapNetworkDrive "h:", "\\frodo\user\" & strSam  
    objNetwork.MapNetworkDrive "j:", "\\frodo\misc" 
    objNetwork.MapNetworkDrive "l:", "\\frodo\department" 
    objNetwork.MapNetworkDrive "q:", "\\frodo\projects" 
    objNetwork.MapNetworkDrive "k:", "\\frodo\department\" & strOu  
    if strOu = "IT" then  
        objNetwork.MapNetworkDrive "x:", "\\frodo\software" 
    end if  
    'WScript.Echo strOut  
    For Each objGroup in colGroups  
        if objGroup.CN = "DreCash" then  
        objNetwork.MapNetworkDrive "p:", "\\gollum\drehcash" 
        end if  
    Next 
    objNetwork.MapNetworkDrive "i:", "\\192.168.1.6\shares" 

  • How to Prompt for User/Pass Running Shell Script Remotely through ARD

    So I finally got my Active Directory Script working! However, I realized that I'm not the only one going to be running this script and to have my user name and password in the script itself is beyond foolish. While I know it's possible just to have whoever's running the script to manually add their username and password, I'd prefer to have prompts to make things easier for the rest of my team.
    Here's my current script. I've tested it on the machine I'm connecting to Active Directory and it works fine if you run it on the machine itself in terminal. However, I'm going to be doing this on about 150 machines and the whole point of the script is to do it remotely.
    #! /bin/bash
    MACNAME=$(scutil --get ComputerName)
    read -p "User Name: " USER
    read -p "Password for $USER: " PASS
    dsconfigad -add "CORP.DOMAIN.NET" \
    -username $USER \
    -password $PASS \
    -computer $MACNAME \
    -mobile disable \
    -mobileconfirm disable \
    -localhome enable \
    -useuncpath enable \
    -shell /bin/bash \
    -ou OU=Macs,CN=Computers,DC=corp,DC=DOMAIN,DC=net \
    -force \
    -localpassword "PASSWORD" \
    -groups "GROUPS"
    When I run the UNIX script through ARD to a machine, I get no prompts for USER or PASS. In fact, it gives me the following error "dsconfigad: Authentication server encountered an error while attempting the requested operation. (5202)" So it's not asking for a user name and password.
    Is there any way to make a shell script prompt you for a User Name and Password when you're sending commands remotely through ARD? Or is there another way to do this?
    Any suggestions would be greatly appreciated.
    -rks

    Best solution is to create an account that is exclusive to binding machines.  By doing this, you can embed the user name and password in the script.  Heck, you can post it on your website.  If the account is configured properly, it will only be able to create machine records in a defined container.  If you are mixing Macs and PCs in your AD domain, I also recommend creating an isolated container for your Mac records.  Now, the account has even less access rights as you can make it so it only has rights to the Mac container.
    Otherwise, ARD does not prompt.  You can play around with an expect script but the reality is that you are still embedding the credentials in the script so it really does not achieve what you want.  ARD is not an interactive shell scripting tool.  It is more a fire and forget.
    Reid
    Apple Consultants Network
    Apple Professional Services
    Author "Mavericks Server – Foundation Services" :: Exclusively available in Apple's iBooks Store

  • Office new to ARD, need deployment script via email

    We are about to manage the Macs at our different offices.  Since most of them were just "run to the apple store and get a mac" deployed, they do not have the sharing enabled to allow ARD to work.  There are also 10.6, 10.7 and 10.8 versions out there.  I have already encountered the dual display bug with 10.6 users.
    I need something I can email to the end users for them to run that will configure ARD to work and only allow access by the admin account that most systems have.  Most of the users have admin rights on their computers.  Any suggestions on how to craft that script to email? 

    The script is simple enough. You can write one to call the kickstart script, or just email a commandline to execute.
    `/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/k ickstart -configure -access -on -privs -all -users <admin_acct_name>`

  • Creating simple shell script packages to deploy with ARD and TaskServer

    I am looking for a simple step by step on how to create a package that can be deployed using ARD, to run a simple shell script like
    "softwareupdate -i -a"
    A brief search here returned nothing, but perhaps I was not using the correct terms.
    Ultimately, I want to use ARD to run software update on ~400 Macs.
    Thanks in advance for your help.
    Bill

    If I send it as a unix command, it will run only on machines that are currently awake and responding to ARD.
    If I can set it up as a package, then I can use Task Server to "deploy" the command to machines that are not currently online. When the machines next contact the Task Server, they will be told to run softwareupdate.

  • Need an updated ARD login script for Mavericks

    We've been using the script below for some years now with very few issues (other than for some reason the multiple returns at the end were needed for some stubborn machines).
    The script continues to work nicely in 10.9--assuming that the cursor is in the name field of the login screen.  More often than not, the cursor isn't.  Because I've yet to teach myself/learn AppleScript, I wander around the lab and manually click into the name field.
    A:  Does anyone know how to tell the machines to place the cursor into the name field?
    B:  Could maybe a future OS update restore the good old days where the cursor blinking in the name field was the default?
    name="username";
    password="userpassword";
    osascript <<EOF
    tell application "System Events"
        keystroke tab
        keystroke (ASCII character 8)
        keystroke tab
        keystroke (ASCII character 8)
        keystroke return
        delay 0.5
        keystroke tab
        keystroke "$name"
        keystroke tab
        delay 0.5
        keystroke "$password"
        delay 0.5
        keystroke return
        keystroke return
        keystroke return
        keystroke return
    end tell

    The less than signs did not have a space.  I took out the the first delay and the last return.
    osascript <<EndOfMyScript
    tell application "System Events"
    keystroke “student”
    keystroke tab
    delay 0.5
    keystroke “***”
    delay 0.5
    keystroke return
    end tell
    EndOfMyScript
    got this error message
    43:44: syntax error: Expected “given”, “in”, “of”, expression, “with”, “without”, other parameter name, etc. but found unknown token. (-2741)
    Are you running your computers with an osx network user logon?  I am.
    thanks.
    Hal

  • Silently/remotely upgrading clients from 10.6 to 10.7 via ARD/Script

    Hi!
    Apple finally made it possible to upgrade from a major OS (10.6 to 10.7) via an application running on the client, rather than having to boot of a DVD on 100 individual computers.
    Does anyone know of a way to kick this installation procedure off remotely?
    Currently I am remoting onto the machines via ARD and manually clicking the "Install Mac OS X Lion" app, then choosing Next, Next, Next, Install
    it would be nice to be able to schedule this via an ARD task so the installer runs silently without the need to click on the GUI to kick off the installation.
    Any ideas?
    TIA!
    FZ

    I can add it's the same with upgrading to Lion... So I guess they changed some driver code between 10.6.7 and 10.6.8 and its not compatible with my logic board.
    Annoying tbh..

Maybe you are looking for

  • Is there a better way to do this? Binary File + MERGE

    Version BANNER Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production PL/SQL Release 11.2.0.2.0 - Production CORE    11.2.0.2.0      Production TNS for Solaris: Version 11.2.0.2.0 - Production NLSRTL Version 11.2.0.2.0 - Product

  • How to call a function in DLL file, while writing test scripts in ATML standards

    Hello all,             I am trying to develop test scripts in ATML standards. I need to call a function in DMM.dll file. How can i do that in ATML standards, please explain with some example ATML standard XML file. Someone please help me in doing so.

  • Af:query - change where clause

    Hi, In my form I have af:query based on a view. also I have a checkbox that indicates to add or remove sql statements from the 'where clause' of the view. for example: my view query is "select * from employees where employees.kod_emp>0" I need that i

  • Multiple projects assignment not available in RfC

    We are using SAP Solution Manager 7.1 SP11. We are using ChaRM and creating change documents with the transaction ZMCR. We are using multiple projects with different systems. We have the following situation: M_ERP_0002 (maintenance project of ECC+BW+

  • LabVIEW careers at JKI

    Want to create real software in LabVIEW and take your skills to the next level? Join JKI.