Quick Fix : Removing a disconnected network drive
August 5, 2011 14 Comments
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:
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.
Then save it..
Now, open your file in notepad.
Insert a “-“ minus sign in front of HKEY
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.
Either way, you should be shown this prompt..
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.
To save this as a ‘BAT’ file, choose file, then save as, set to all files, and type your file name.
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