I use the following script to attempt to eject all disks that aren't internal:
tell application "Finder"
eject (disks whose ejectable is true)
end tell
This has the advantage of skipping volumes like MobileBackups
as well as several others.
Unfortunately, it doesn't eject network shares.
Is there any way to get connected network shares in applescript?
As a +1, ideally this would skip things like optical disks as well.
EDIT: Both answers so far have shared ways to eject specific network disks. This, of course, is easy and I know how to do it. What I'm specifically asking for is a way to attempt to eject every disk other than system internal disks, regardless of their name.
The Disk "32-digit UUID" wasn't ejected because one or more programs may be using it.
but I can't figure out what that UUID corresponds to. It is not listed indiskutil info -all
for example. Also nothing is listed in lsof. This is on OSX High Sierra. Any suggestions?