Case of The Disconnected Drive That Wouldn’t Go Away

In a remote desktop connection to a Windows 2008 R2 box I had a drive that showed up a Z: and showed up as Disconnected, but right clicking and selecting “Disconnect” I recieved the error:

The network connection does not exist.

The mapped drive was operational, connected to a network share, but I no longer needed it

image

Running ProcMon while attempting to remove the drive I noticed an ACCESS DENIED on an .ini file, in a folder I didn’t even have access to at all.

image

Typically a user’s persistent mapped drives are stored in HKU\Network\<Drive Letter> key within the registry. This drive mapping was persistent across logoff/logon, but kept coming back.

So I thought, what if I add the registry entry in manually, and I set it to a folder I had full control of.

I set the following registry values:

ConnectionType REG_DWROD 0x1

DeferFlags REG_DWORD 0x4

ProviderName REG_SZ Microsoft Windows Network

ProviderType REG_DWORD 0x00020000

RemotePath REG_SZ <file share>

UserName REG_SZ <blank>

image

After adding this entry, I was able to right click drive and Disconnect worked!

About chentiangemalc

specializes in end-user computing technologies. disclaimer 1) use at your own risk. test any solution in your environment. if you do not understand the impact/consequences of what you're doing please stop, and ask advice from somebody who does. 2) views are my own at the time of posting and do not necessarily represent my current view or the view of my employer and family members/relatives. 3) over the years Microsoft/Citrix/VMWare have given me a few free shirts, pens, paper notebooks/etc. despite these gifts i will try to remain unbiased.
This entry was posted in Explorer, ProcMon, Troubleshooting and tagged . Bookmark the permalink.

9 Responses to Case of The Disconnected Drive That Wouldn’t Go Away

  1. Pat B. says:

    Thank you. I had exactly the same problem, and this was very helpful indeed!

    If you have another valid share, an easy way to create the necessary registry entries is to export the entry for the valid share, which creates a file, then copy the file giving it a new name (but with a filetype of “.reg”), edit the copied file, and then double-click on the file you updated to have the entry put in the registry. Since you’re only editing the data, this approach ensures that you have the names and data types correct for each of the entries.

    If the valid share you have is drive G:, the registry entry you want to export is HKEY_CURRENT_USER\Network\g, which will copy that entry and all the entries in the pane on the right to a file with a filetype of “.reg”.

    When you then disconnect the drive you were unable to disconnect before (in “My Computer”), the entry you added to the registry using the file you edited will be removed.

  2. Zach H says:

    The above instructions didn’t work for me (the mapped drive that was broken was on a Unix filesystem which I couldn’t verify full access permissions) but these ones here did the trick – http://www.falconitservices.com/support/KB/Lists/Posts/Post.aspx?ID=213 – delete the reg entry specified there then restart explorer.exe (or the computer entirely, of course) – and the disconnected drive disappears.

  3. kalothathome says:

    Thanks! this really helped :)

  4. Mike says:

    I thought this would be the answer I needed, but it was not. I have a drive X: mapped to a remote drive. But when I go to delete X:, it says the network connection does not exist. Also, I cannot “disconnect” the mapped drive either. When I looked in the registry, HKCU\Network – drive X: does NOT appear. I am not sure what to do now. A remap to a different letter does NOT work either, Any help would be appreciated.

  5. Algar says:

    Very useful, thank you. I’ve uploaded the .reg file to here to make it easier to create the key: http://www.osdeasy.com/scripts/ZDrive.reg

  6. Marc J. says:

    This isn’t working for me, at least not in Windows 10. I have a W: drive that currently says “Disconnected Network Drive (W:)” in Windows Explorer with a red X through it. It cannot be deleted or otherwise removed. I added the registry key for a W drive exactly as described here and identical to other mapped drives, except for the RemotePath (which is one of my local server’s shares, like \\server_name\share_name).

    If I type “net use” in a command window to list all of my mapped drives, it does list the W: drive however it has “Unavailable” for the Status where all others say “OK”.

    I restarted the Windows Explorer process (in Task Manager) just to make sure it’s not caching anything and double-click on the W: drive. A dialog pops up titled “Restoring Network Connections” and it says:

    “An error occurred reconnecting W: to
    Microsoft Windows Network: The local device name is already in use
    The connection has not been restored”

    It still cannot be disconnected.

  7. This also may happen if a drive is mapped under LocalSystem context – drives appear as disconnected in all user sessions for some reason. You can eventually unmap them via psexec -s cmd (to start cmd as LocalSystem), then net use drive: /delete /y. The drives disappear immediately :)

    • Kent Smith says:

      You’re awesome, Petar!!! I’ve looked for a solution to this a hundred times and yours was right on the money. Thanks so much!

  8. Sritrisha says:

    Few drives remain connected all the time and few Lotus Notes drive gets disconnected very often… If I click on the disconnected drive it gets connected automatically or at times I need to provide the password of the drive to get them connected. Can anyone please help how can we keep the drives connected always?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s