Re: Mapping Network Drives and Trapping Errors to Return Success or Failure. by Al
Al
Tue Jul 20 16:49:32 CDT 2004
"Hardeep Rakhra" <mail@rakhra.org.uk> wrote in message
news:2m00poFg49bfU1@uni-berlin.de...
> Al Dunbar [MS-MVP] wrote:
> >
> > To whom or to what do you want to "return the error"? Do you just want
to
> > display a pass/fail message to the user?
>
> > In a logon script, it is not going to be of much value to explain the
cause
> > of the failure to the user. They are usually interested only in whether
or
> > not they can work. In any case, most of the reasons for failing to map a
> > share (server not available, number of share connections exceeded,
access
> > denied, etc) are beyond their capability either to understand or to fix.
>
> The main reason for returning the error to that it can be written to
> log, so in the event things do start going wrong, we can follow the
> where and why of the error. It's somthing i'd rather not report to the
> user for all of the reasons you state.
Are you expecting that things will "start going wrong" for some reason? If
so, what sorts of things are you expecting to see happen?
IMHO, most of the causes of share mapping failure relate to problems that
become obvious, or can be monitored, in some other way. If the server
hosting the share is down, for example, then it will affect everyone mapping
to any shares there. That can often be as easily diagnosed by the help desk
calls.
Most of the other possible causes of failure are similar. However, if it is
a networking problem on the workstation (unplugged?), it is not going to run
the logon script anyway, assuming you run them from netlogon share on a
domain controller.
Finally, it is possible to attempt to map to a non-existent share. That is
generally going to be a hard error, that is, it won't work for a while and
then "start going wrong".
Anticipating what actions in logon scripts might fail is a good thing.
Logging such events, giving the err.number, err.description, time, user, and
etc. is also a good thing. But I still think it can be overdone if you are
not careful. If you log to a network share, well, what happens if there is a
problem accessing that share, and where would you log *that* situation? If
you log to a local file, you will have to have some way to collect the
errors to analyze them.
> I thought it was a zero returned too, but i've had a 500 returned where
> the mapping has suceeded which is what threw me.
Do an err.clear before mapping the drive, just in case. What was the
err.description that corresponded to the 500?
> I would have thought logging errors in a logon script would have been a
> pretty standard feature to include as it makes tracing issues alot
> easier in the log run.
I don't know how common, but we do it (to a local file in the %temp%
folder), and it is definitely worth doing. Mind you, we have only ever used
it to track down the cause of specific problems reported by the users. We
have never proactively analyzed these logs looking for unreported errors.
/Al