Eject All Disks:
This ejects everything except your boot disk, and a disk called “Media”, in my example. Feel free to build your own exception list by just modifying and adding on to the otherDisks definition.
tell application "Finder"
set bootDisk to name of startup disk
set otherDisks to every disk whose (name is not bootDisk) and (name is not "Media")
repeat with myDisk in otherDisks
try
eject myDisk
end try
end repeat
end tell
Eject Server Volumes:
tell application "Finder" to eject (every disk whose local volume is false)
Leave a reply