You don't need to parse the output of
NET VIEW, since (at least)
the
ActiveState Perl build has
a module
Win32::NetResource which can do network enumeration and even
network connections (like (un)mapping a new network drive). This might
of course be too much, as
NET VIEW already does
produce the output you need and does all the error handling, but if you
maybe want finer control and maybe are not too interested in
running under DOS or Windows 3.1, that module could be
of interest to you.