Apple Remote Desktop - Send Unix Commands

Note: These commands originally came from http://homepage.mac.com/applesd/page2/page1/page0/index.html which fell off the internet around September 18, 2007. I've published them here so the are still available.

Apple Remote Desktop lets you execute UNIX shell scripts or commands on any number of your client systems at once. This gives you even more power over your Mac OS X client computers. You can script many of the standard functions built into UNIX systems, as well as take advantage of the command-line interfaces in Mac OS X.

Use the "User" radio button to run tasks as root.

Unix Commands - use at your own risk
Open and Close a CD Tray drutil tray open
drutil tray close
Repair Permissions of drive diskutil repairPermissions /
Retrive SMART Drive Status diskutil info disk0 | grep SMART
Run "daily" script periodic daily
Run as "root" user
Run "weekly" script periodic weekly
Run as "root" user
Run "monthly" script periodic monthly
Run as "root" user
Update Prebindings update_prebinding -root / -force
Run as "root" user
Set System Volume osascript -e "set volume 7" - Options are from 0 to 7
Check Battery Cycle Count ioreg -l | grep Capacity - 10.3.8 or higher
networksetup networksetup -help
systemsetup systemsetup -help
airport --scan /System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport --scan
airport --getinfo /System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport --getinfo
airport --showstack /System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport --showstack
Spotlight Serach - 10.4+ only mdfind pdf - change "pdf" to the file extention you wish to find.
Show a list of users who have logged in last
Set Software Update Server Address:
This is a per user setting.
defaults write com.apple.SoftwareUpdate CatalogURL http://xxx.xxx.com:8088/index.sucatalog
Remote GUI login via Apple Remote Desktop:
osascript -e 'tell application "System Events" to keystroke "LOGIN_NAME"'; \
osascript -e 'tell application "System Events" to keystroke tab'; \
osascript -e 'tell application "System Events" to delay 0.5'; \
osascript -e 'tell application "System Events" to keystroke "PASSWORDHERE"'; \
osascript -e 'tell application "System Events" to delay 0.5'; \
osascript -e 'tell application "System Events" to keystroke return'

Replace LOGIN_NAME and PASSWORD with the proper values
Run as "root" user
Change a local users password: dscl . -passwd /Users/user_name new_password
Run as "root" user
Run Software Updates Remotely softwareupdate -i -a
Run as "root" user
View all running applications osascript -e 'tell application "Finder" to get name of every process whose visible is true'
Flush MCX Cache
For 10.4.x
rm -r /Library/Managed\ Preferences/*
/System/Library/CoreServices/mcxd.app/Contents/Resources/MCXCacher -f
Run as "root" user
Flush MCX Cache
For 10.2-10.3
/usr/bin/nicl -t 127.0.0.1/local -delete /mcx_cache
Run as "root" user
Quit Application killall Application-Name
Login as user
osascript <<EndOfMyScript
  tell application "System Events"
      keystroke "test1"
      keystroke return
      delay 3.0
      keystroke "test1"
      delay 3.0
      keystroke tab
      keystroke return
      keystroke return
  end tell
EndOfMyScript
submitted by Amira Sakr


Fun Commands - use at your own risk
Make Computer Speak Say "Your Text Here"
Computer Speaks Current Date osascript <<EOF
say (current date) as string using "Cellos"
EOF
Optical Tray Wave Script for i in 1 2 3 4 5; do
drutil tray open
sleep 1
drutil tray close
sleep 1
done
Machines sing the list of software updates. osascript <<EOF
set suList to (do shell script "softwareupdate -l") as string
say suList using "Cellos"
EOF

Know any other usefull commands? Drop me a line!