How to run a one-time command on multiple mac clients?

1

I need to run a simple one-line command on a few dozen macs. I only need to do this once.

They are all running Mountain Lion, except for the server that manages them, which is running Lion Server.

They are all in the same logical group in Workgroup Manager but I didn't see anything useful. Since this is a managed environment, is there a way to push a script through?

Louis

Posted 2014-01-23T20:31:40.480

Reputation: 18 859

Do you have ssh access to the machines? – terdon – 2014-01-23T20:46:46.523

@terdon Yes, I do. – Louis – 2014-01-23T21:14:12.980

Answers

2

From the command line of the management server you could do something like:

user@server:~ # for i in `cat list_of_clients.txt` ; do ssh "$i" "/path/to/command" ; done

gurple

Posted 2014-01-23T20:31:40.480

Reputation: 456

Had trouble getting this to work until using the -t flag. – Louis – 2014-01-28T18:06:04.137

2

This is trivial to do with Apple Remote Desktop via the Send to UNIX... command. @gurple's answer will work if you have key pairs exchanged, or don't mind typing the password to each machine (a few dozen times sounds like an ARD purchase would be justified).

peelman

Posted 2014-01-23T20:31:40.480

Reputation: 4 580