Solved

Unable to disconnect network drive windows

Posted on 2004-08-12
5
1,468 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
Comment Utility
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
Comment Utility
that didn't seem to show up anything but thanks anyway. Any other ideas?
0
 
LVL 2

Expert Comment

by:stardust126
Comment Utility
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
Comment Utility
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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Just about everyone has an old PC laying around.  Ask anyone in the IT industry, whether they are a professional or play in it as a hobby.  From outdated Desktops to cheap "throwaway" laptops, they are all around and not as hard to "fix up" as you m…
Many people tend to confuse the function of a virus with the one of adware, this misunderstanding of the basic of what each software is and how it operates causes users and organizations to take the wrong security measures that would protect them ag…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now