Quick Fix : Removing a disconnected network drive

A client of mine needed to move a Data folder from one of there servers, to another.

Easy enough right? Just Copy the data off ahead of time, like a seed copy, then on the day of the switchover just do another, to copy the changes. Robocopy is great for that and a great resource for Robocopy is here, stop sharing the source and start sharing the destination.

The complicating factor here, was that they access this folder via a mapped drive. Ordinarily not an issue, you can simply disconnect the drive, and remap to the new server. Except – you cannot do this if your mapped drive is showing disconnected.

At this client, all the mappings to this particular folder were showing disconnected – however the drive still worked. It was one of those issues we looked at and thought, huh, that is weird, oh well it still works so we will look at that tomorrow.

Tomorrow being that 8th day in the week.

So here i was on  Sunday evening, thinking ah, i hadn’t thought of that – how can i get this drive switchover completed with minimal disruption to the users?

Well firstly i had to solve the problem of not being able to remove the drive letter.

If you search on the internet you can find a large amount of posts from people suffering from this issue, occurring on both XP and Vista, and probably Win 7 as well.

Things like net use x: /delete or net use * /delete, were not working, and neither was simply right clicking the drive and saying disconnect.

I hit upon this article which shows the possible cause of the problem, and the solution. http://support.microsoft.com/kb/932463

“A mapped network drive appears to be disconnected after you install or upgrade to Symantec AntiVirus 10.0 or to Symantec Client Security 3.0 on a Windows Server 2003-based computer or on a Windows XP-based computer”

Well, this client did indeed use Symantec, so, cause identified, move on to the solution.

Quite simply, a registry edit.

Navigate to this path in the registry:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2

You should see at the top, a number of entries like this:

1

Each entry that starts ##SERVERNAME is a mapped drive. Not much help from the DWORD values in the details pane to tell you which Drive Letter, but, after ##SERVERNAME is #Folder – so from that you can hopefully narrow down which entry relates to your ‘Disconnected Drive’

So now we have the solution, how to roll this out to 20 client machines with the least effort?

Enter this Article: http://support.microsoft.com/kb/310516 

Reading through this article we learn about how to use a .REG file to modify the registry and how to use a .REG file in conjunction with a BAT file.

You may be way ahead of me now, but for those that aren’t..

First, i exported the registry key and saved it. You can do that by Right Clicking the key, and clicking Export.

3

Then save it..

4

Now, open your file in notepad.

5

Insert a “-“ minus sign in front of HKEY

6

Save your file.

You now have a .REG file that will remove this drive mapping from your computer. To run the file just double click it,

If you find this just opens the file in Notepad again, right click the file, choose ‘open with’ and then choose Registry Editor.

7

Either way, you should be shown this prompt..

8

It may vary slightly from OS to OS, but essentially it is the same warning. You want to say YES at this point.

When you click Yes, the entries defined inside our .REG file are removed from the Registry. A reboot of the PC and the ‘Disconnected Drive’ is now gone!

Ok, i know what your thinking – how does this help us with 20 computers? Get 20 users to run it? NO!

Well, you could, but try getting a user to do anything even remotley dif… anything, and you hit resistance :p

As i mentioned above, the article http://support.microsoft.com/kb/310516 , not only shows us how to delete entries from the registry with a .REG file, it also tells us how to run .REG files silently within a BAT file.

So what i did was to put my .REG file on a server share that was open to all users.

I then wrote a BAT file to call that .REG and run it silently.

9

To save this as a ‘BAT’ file, choose file, then save as, set to all files, and type your file name.

10

I then added this as a logon script using a Group Policy Object. I am not going to cover how to setup a GPO as it is a little beyond the scope of this post.

So come Monday morning, all users logged on and had their Drive deleted, they were all told to reboot after logon.

I had also written a new BAT file to map their drive to the new location, and how many support calls did i get? ZERO!

 

Ok i got one, but that guy was on a mac Smile with tongue out

About Robert Pearman
Robert Pearman is a UK based Small Business Server enthusiast. He has been working within the SMB IT Industry for what feels like forever. Robert likes Piña colada and taking walks in the rain, on occasion he also enjoys writing about Small Business Technology like Windows Server Essentials or more recently writing PowerShell Scripts. If you're in trouble, and you can find him, maybe you can ask him a question.

12 Responses to Quick Fix : Removing a disconnected network drive

  1. Morrie says:

    Great hammer of Thor, that is poewruflly helpful!

  2. Phillip Rudd says:

    worked like a dream thanks windows wouldn’t let me remove it through its gui thank yooooooou

  3. jp says:

    i’m still having the same problem with mapped drives. in the registry there are no entries for mapped drives. what now?

  4. I would search the entire registry for any drive mappings.

  5. Well yeah, some creative solutions here. Use one MS flaw to solve another I say! lol
    The persistence of disconnected drive letters is [b]flaw B[/B]
    Flaw A is that WinDOS has a tendency to lose it’s desktop if copies of explorer go awry. I DON’T mean IE I mean MS explorer. All instances will have the PID title “explorer” IE will have PID name “IEXPLORER”

    You can get rid of orphaned disconnected network letters by “resetting” the desktop.” That’s easily accomplished by going into taskmgr and deleting all instances of “explorer” Voila–no more desktop! To bring it back you merely need to explore a drive –But HOW when there’s no drive icons– One easy way is open taskmgr again, Go “FILE/New Task/Run/%temp%”. That will cause the temp directory to come into focus and will essentially reset your desktop–WITHOUT the orphaned Network references.

    Fight Fire with Fire. I’ve seen folks looking for a solution to this BUG for years.

  6. I DID forget to mention that when you reset your desktop you may have to restart “Terminate and Stay Resident Apps” You’ll have to look it up if you don’t know the term ;-) I’m not going into it here and it’s IMO a pretty minor detail to keep tack of. I only have 2, if you’ve got a TON of them, You really shouldn’t–but the whole thing COULD be done in a script–but then my solution would look as convoluted as some of the others I’ve seen :-))

  7. Mark says:

    To disconnect the drives, simply end the explorer process and restart it again vis Task Manager.

  8. Matt says:

    Worked for my on Server 2008 RC2 after rebooting. I have a script that will map roughly 10 drives. Running script as administrator says successful but no drives show up. If I run it without administrator, they map. Strange but at this point, I’m done questioning things. Thanks for the solution.

  9. have a suggestion, that i think alot of people overlooked. It took me a while to find it.Since its a server i was having issues with. i looked at users, ctl – alt -del. Then i noticed another login under users. Same user name, logged off, but still there. i then logged them off again, using the option, logoff, suddenly my mapped drives are fine. Shows amount of storage, used, etc. So looks like this solved my issue with losing mapped drives. Hope this helps others still scratching there heads.

    Kriss

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

Follow

Get every new post delivered to your Inbox.

Join 383 other followers

%d bloggers like this: