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.