I have mapped a network drive using the WScript object through an ASP page. See below:
Set WshNetwork= CreateObject("WScript.Network")
Set oDrives = WshNetwork.EnumNetworkDrives
WshNetwork.MapNetworkDrive driveletter,"remoteserver", False, "username", "password"
' do some work
Set WshNetwork= Nothing
This all seems to work fine except sometimes the drive doesn't get removed and when i log into the server to try and disconnect the drive, it tells me the network connection cannot be found. The network drive is displayed with a red 'X' over it. If I try to remap it, it does not appear in the list of drives. If i use the net use delete command it doesn't work either. The only solution I have found to this problem is rebooting the server and there's only a certain number of times a day i like to do that. Any suggestions would be great as I've been trying to solve this problem for a while now.