How do I write a script to disconnect all network drives?
Are these shares automounted?

You could use AppleScript, or even bash quite effectively to do this using a Log Out Hook (or running manually):

tell application "Finder"
    if ((count of disks) &gt; 1) then
        set drives to disks
        repeat with drive in drives
            eject drive
        end repeat
    end if
end tell