Q: AppleScript to add computers to a computer list
I would like to use AppleScript to add computers to a computer list in ARD. Each morning I get a list of Macs that are supposed to be running automations but the automation server has lost contact with some. I then have to figure out why. Some mornings there are three and it's easy but some mornings there are 60. I've figured out the way to parse the list of Macs. However, I've had no success setting up an AppleScript to "control" each of the offending Macs (and I'm testing with ones that are active). Nor have I had luck adding the Macs to an existing list. The Macs are all already in All Computers. Even trying to add one single Mac has been unsuccessful. When I run this script ARD pops to the front but nothing happens.
set remoteComputer to "deadMac001" as text
tell application "Remote Desktop"
activate
add remoteComputer to computer list "Test List"
end tell
It would seem through my testing that adding a computer from scratch you need to know the IP address. But these Macs are already in my ARD I don't need to add them to ARD I just need to add them to a computer list. Any suggestions would be appreciated! At work I'm up-to-date with El Capitan 10.11.4 and ARD 3.8.
-Doug
Posted on Apr 11, 2016 5:32 PM
You didn't add enough detail about your process to be more specific, but here's a simple script to create a new list and add a computer from the "All Computers" list:
tell application "Remote Desktop"
set myList to make new computer list
set name of myList to "Scripty List"
add (the last computer of the computer list "All Computers") to myList
end tell
alternatively, you could say:
add the computer "Brian’s 27\" iMac" to myList
HTH,
-Brian
Posted on Apr 12, 2016 8:12 AM