Solved

Unable to disconnect network drive windows

Posted on 2004-08-12
5
1,472 Views
Last Modified: 2012-06-21
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
      
WshNetwork.RemoveNetworkDrive (driveletter)
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.
0
Comment
Question by:Splinst
5 Comments
 
LVL 40

Expert Comment

by:Fatal_Exception
ID: 11783159
Check the following registry keys for the Dword values below.  I doubt whether this is the problem though, since it is primarily for only removing the context menu option, but you may want to ck anyway...

User Key: [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\
Explorer]
System Key: [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\
Explorer]
Value Name: NoNetConnectDisconnect
Data Type: REG_DWORD (DWORD Value)
Value Data: (0 = disabled, 1 = enabled)
0
 

Author Comment

by:Splinst
ID: 11790907
that didn't seem to show up anything but thanks anyway. Any other ideas?
0
 
LVL 2

Expert Comment

by:stardust126
ID: 11801270
Next time it happens to you, search the registry for the mapped drive and delete the realted key.
See if it fixes your problem without booting the server.
0
 
LVL 2

Accepted Solution

by:
catknows earned 250 total points
ID: 11858027
Commonly when one disconnects a network drive, one should flush out all the remaining data the the cashe memory.  When open a file and does some change to it and close, windows might not actually update it until when it's free.  Calling disconnecting routine without calling cleaning up routines, might result in disconnecting the network incomplete.  I don't know .NET programming, but that is the general rules.

Hope that help.
0
 

Expert Comment

by:Bblues
ID: 25861647
I had same problem.
Here workaround:
in this example x: drive
-cmd delete net network drive: net use x: /d
- regedit remove following folder 'x' under reg-key [HKCU]\Network
Reboot system.
hope this helps

0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Occasionally Windows/Microsoft Updates will fail to update. We have found a code that will delete all temporary files and re-register all dll's related to Windows/Microsoft Updates! This works 99% of the time to get the updates working again! The…
#Citrix #POC #XenDesktop #vCenter #VMware #ESX
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question