In case it might be of some help, here's my ham-handed attempt at reconnecting the share from the workstation that has lost the share.
This was concocted after reading for several hours about Windows Scripting.

    * this is in the ON ERROR function
    * tnErrorNo is derived early in the procedure
= Aerror(laErrorArray)
tnErrorNo=VAL(TRANSFORM(laErrorArray(1,1)))
IF tnErrorNo=1 OR tnErrorNo=1104
        * network drive has gone away
    oNet = CreateObject("WScript.Network")
* get list of mapped drives. this returns an object with an array property "item" * Item is a zero-based associative array of "drive letter" = "map path"
        * example: loDrives.item(1)= '\\192.168.0.25\c\'
        * we are only concerned about drive S, our server map
    loDrives=oNet.enumnetworkdrives()
    IF loDrives.count>0
        FOR nnum=0 TO loDrives.count-1
            IF lodrives.item(nnum)='S:'
                    * force removal in case the map exists
                    * otherwise WScript throws a hissy fit
                oNet.RemoveNetworkDrive("S:",.t.,.t.)
                exit
            ENDIF
        endf
    ENDIF
    RELEASE ALL LIKE loDrives
        * pause a second
        *    =sleep(1000)
        * reconnect. The third param is for "persist? y or n"
* the "appl.serverpath" is an application-wide drive map spec for the server. * it varies from building to building, subnet to subnet. So each machine has the path
        * defined for it in the local INI file and is extracted at startup.
      oNet.MapNetworkDrive("S:", appl.serverpath,.t.)
      RELEASE ALL LIKE oNet
      On Error &lcError
      retry
ENDIF

Maybe this will provide some spark of creativity.

It looks like I could incorporate this into my error handler. Thanks!

Ken Dibble
www.stic-cil.org


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to