Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Unable to disconnect network drive windows

Posted on 2004-08-12
5
1,473 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
error while running the scirpt 24 141
Windows 7/OS X dual boot 10 82
hp mini 3 67
Problem with Filesystemobject or .NET version 3 76
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…
As the title indicates, I have done this before. It chills me everytime I update the OS on my phone, (http://www.experts-exchange.com/articles/18084/Upgrading-to-Android-5-0-Lollipop.html) because one time I did this and I essentially had a bricked …
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.

856 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