Shortcut to eject all external hard drives but not MobileBackups
You can do the following instead:

tell application "Finder"
  eject (every disk whose ejectable is true)
end tell


If you have partitioned disks mounted, hold down the 
"Option" key, run your script, then release the key when done.