Updated: Send softwareupdate command through ARD

by on April 8, 2010 » Add more comments.

This script will run software updates only on machines that are logged out. This ensures you don’t reboot machines that are in use and don’t leave machines in an inconsistent state (by not rebooting after patching). This is not a perfect solution to patching but it’s better than nothing. You can even schedule this to run on a recurring basis.

Update: Added sleep command with random wait. This will help alleviate some load on your SUS and perhaps prevent a DOS attack. Thanks to rsaeks via Twitter.

Copy and paste the following into an Apple Remote Desktop (ARD) “Send Unix Command” window and send as root:

# Random number of seconds to wait
# The more machines you use this with, the higher the number should be
sleep `expr $RANDOM % 120`
if who | grep console; then
echo Machine is in use
exit 1
COMMAND_LINE_INSTALL=1 softwareupdate -i -a
shutdown -r now
exit 0

Find more like this: Automation, Desktop Management, Mac, Scripting , , , ,

3 Responses to Updated: Send softwareupdate command through ARD

  • Adam says:

    I found this on a mailing list or sysadmin blog a while back. I used to wait until off peak hours to run updates.

    With this command I can run anytime. Thanks for posting this!

  • Bug says:

    Yea, this is great – thanks!!

  • Scott Lepping says:

    This command does work and the client computer reboots, but the unix task in ARD never finishes. Is there any way to resolve the task not completing in ARD?


Leave a Reply

Your email address will not be published. Required fields are marked *