The fMsg() UDF can be used to write timestamped logging info to a file. With it, you can add messages before and after each mapping, allowing you to determine which connection is causing a problem. The timestamps will show how long each mapping takes, along with the result of the command.

Ideally, you'd be using a common UDF to map the drive connections, rather than many separate Use statements. If you don't, its easy to change.. convert the Use command to a fUse function
 Code:
Use M: \\server\share
becomes
 Code:
fUse('M:', '\\server\share')
and the fUse could be as simple as
 Code:
Function fUse($_Drv, $_Share)
 Dim $_Msg, $_Err
 $_Msg = 'fUse:Mapping ' + $_Drv + ' to ' + $_Share
 fMsg($Msg, '', 0, 20)
 Use $_Drv $_Share
 $_Err = @ERROR  ; preserve result from USE command
 fMsg('fuse:' + @SERROR', '', 0, 20)
 Exit $_Err
EndFunction
The fMsg UDF will write to a log file defined by a global variable called $MSG_LOG_, but only if the global variable $DEBUG is non-zero. The last parameter - "20", prevents messages from displaying on the screen (bit value 16) and only if in debug mode (bit value 4).

Somewhere in the beginning of your code, add the following:
 Code:
Global $MSG_LOG_, $DEBUG
$MSG_LOG_ = '%TEMP\LoginMessages.log'
$DEBUG = 1


Don't forget to include the fMsg UDF in your script! The latest version of fMsg can be obtained from the Kix UDF Library in the Resources section of my web site. After diagnosis, you can set $DEBUG = 0 to turn off logging - no need to remove the calls to fMsg.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D