Updated: Send softwareupdate command through ARD

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:

#!/bin/sh
 
<pre lang="bash"># 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

fi
COMMAND_LINE_INSTALL=1 softwareupdate -i -a

shutdown -r now

exit 0

Bookmark and Share

Related posts:

  1. Bind to OD Script & Add to Computer Group
  2. Script to Configure the Mac OS X firewall
  3. Add user to admin group with Applescript
  4. Migrate Local User to Domain Account
  5. Add directory services data to LANDesk inventory

Automation, Desktop Management, Mac, Scripting -->

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

2 Responses to “Updated: Send softwareupdate command through ARD”

Leave Comment

(required)

(required)