Windows

Clearing the Windows XP Map Network Drive’s MRU list


If you frequently use the Map Network Drive command in Windows XP, you probably have a lot of network paths displaying in the MRU (Most Recently Used) list, which appears in the Folder dropdown menu. If so, you may at some point in time want to clear that list -- especially if it contains UNC paths that you no longer use. Here's how to clear the Map Network Drive's MRU list:

  1. Launch the Registry Editor (Regedit.exe).
  2. Go to HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Explorer \ Map Network Drive MRU.
  3. One-by-one, delete each string value associated with a drive mapping by selecting it and pressing the Delete key. (Each entry will have the name of a letter of the alphabet, e.g. a, b, c, etc.)
  4. Double-click on the entry titled MRUList to open the Edit String dialog box.
  5. Delete the text in the Value Data text box and click OK.
  6. Close the Registry Editor and restart Windows.

Miss a Windows XP tip?

Check out the Windows XP archive, and get more hands-on Windows XP tips.

Stay on top of the latest XP tips and tricks with our free Windows XP newsletter, delivered each Thursday. Automatically sign up today!

About

Greg Shultz is a freelance Technical Writer. Previously, he has worked as Documentation Specialist in the software industry, a Technical Support Specialist in educational industry, and a Technical Journalist in the computer publishing industry.

34 comments
Dumphrey
Dumphrey

net use * /delete /y ? That deletes all net maps. bye bye. And they no longer exist in the registry after... and no need to reboot.. Im confused.

toms45
toms45

Gracious, the man provides an automation script and all you guys can do is complain. If that's too hard for you to understand, then you obviously are not developers. VB Script is probably the easiest to use language for this type of work. Many, many daily admin tasks are performed by scripts like this one on corporate servers and end user PC's. You can use whatever you want to clear an MRU list, but some of the suggestions in other posts will NOT clear the MRU of networked drives. Disconnecting or deleting a network connection will not clear it. Be careful with Ad Aware and Spybot - be aware that they'll clear all MRU's by default. You may lose one that you really need.

ALQuinones
ALQuinones

I was just wondering, does the "net use * /d" command do the same thing? If so I think this is safer than editing the registry.

Betelgeuse58
Betelgeuse58

I just use Ad-Aware and Spybot Search & Destroy to get rid of MRUs. B-) It's [b]much[/b] safer that way. ;)

joeaxe
joeaxe

How would you remove a lan printer form the printers objects folder (list) If the server it belongs to no longer exists? Not from deleting the printer object -- it wont let you (because the server doesnt exist. Thanks in advance

welldone
welldone

Original Post in wrong thread: Does this have any affect on the Nethood entries? Would like to easily clear the ones that are no longer needed.

joyce
joyce

there was nothing in the explorer saying 'map network drive MRU' .. is that because i regularly run the registry checker or because i now use firefox? or do i have a problem? pc is fine apart from i cant now get into my work extranet site or my aol mail since going over to firefow .. any suggestions would be welcommed! joyce@byers25654.orangehome.co.uk

medbiller
medbiller

Isn't it simpler & safer to delete this mapped drives in the Windows Explorer ?

iansavell
iansavell

Useful article, I just cleaned my own huge MRU down to the 10 or so current values. All our business data is on about 10 mapped drives. No-one ever remembers where the drive letters point, and that changes anyway when we reorganise data etc. Doesn't matter in the office because the login script handles it. Home users need a batch file to set up the drives. Sometimes they cheat by doing it themselves from the MRU and typically get it wrong, generating an out of hours support call. Could I just add a command to the batch file to replace the entire contents of the Map Network Drive MRU key using a .REG file so only the current mappings are suggested? That also means I can set up the minimum required drives in the batch file and tell the users to map the rest when needed. Thanks for the article Ian

JCitizen
JCitizen

associations or can another net use command recover previous connections? I've always understood that you could always back track using net use...?

Level
Level

The purpose of the 'net use' command is to connect or disconnect a network resource. Mr. Shultz is talking about deleting entries from the drop down list in the 'Map Network Drive' dialog.

JCitizen
JCitizen

on the local machine. And an intruder could use the same command to restore previously used information. Maybe someone will weigh in and correct me.

justin.w.walsh
justin.w.walsh

Its companion is Spyware Blaster. My performance (software) has improved immensely.

JCitizen
JCitizen

files now(2007). It lists data index files instead of calling the same files "cookies". I haven't used it enough to see how it handles MRUs yet. With the previous SE version it was simpler.

Robert Hird
Robert Hird

Obviously back up the root key before going in to delete but each printer is listed under: HKEY_CURRENT_USER\Printers\Connections Delete the ones that the print server has been renamed or does not exist any longer. Afterwards, restart the spooler service to ensure everything starts back up properly. Good luck.

Level
Level

I've found that if you have sufficient patience, you can clear unwanted Nethood (My Network Places) entries from Windows Explorer. Windows XP Pro instructions: 1. Right-click on entry to be removed. 2. If the network resource no longer exists, wait a minute or more for Windows Explorer to time out. Be patient, do nothing else while waiting. 3. Click OK on any messages stating that the network connection is missing. 4. Eventually the context menu you requested in step 1 should appear. 5. Click on Delete. 6. Confirm, to send the shortcut to your Recycle Bin. Although the items that you are deleting may not have a shortcut icon, in my experience, they are just shortcuts. You can't delete the actual folder from the network by this method.

welldone
welldone

Does doing so clear the entries from Nethood that you no long want?

medbiller
medbiller

When you map network drives permanently, they show up under MyComputer>Drives with a coax cable T-connector under the drive image. You just select or multi-select the ones you don't want anymore and hit Delete.

thomasboomer
thomasboomer

The author's script is not about deleting mapped drives, so that wouldn't do the job at all. MRU means Most Recently Used, and the MRU list the author is referring to appears when you go to map a drive and click the drop down list. There you will see a "remembered" list of network paths. For various reasons you may not want users to have access to a list of network locations. The only other way to delete that list is to delete the entries manually from the registry. By using a script you can automate that process and eliminate user error.

Level
Level

Yes, that is a simpler and safer method to delete mapped drives. But Mr. Shultz is talking about deleting entries from the drop down list in the 'Map Network Drive' dialog.

PJfromOttawa
PJfromOttawa

Be careful of wrapping below: Take the following text and save it in a file called "Clear Mapped Drives MRU List.vbs" - It can list, clear, and set the MRU List - NOTE: It won't change anything if you don't change DO_WRITES to True - You're welcome ---------------------------------- '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 'NAME: Clear Mapped Drives MRU List.vbs 'DESCRIPTION: 'LANGUAGE: VBScript 'Instructions: ' Double-click on this file from Windows Explorer and it will simply list ' the contents of the current MRU List ' to Delete or Set, bring up a command prompt, CD to the folder where this ' script is located and call it like this: ' C:\SomePath>CSCRIPT "Clear Mapped Drives MRU List.vbs" DEL ' or ' C:\SomePath>CSCRIPT "Clear Mapped Drives MRU List.vbs" SET ' 'When using "SET" option, it will use the comma-separated list in NEW_LIST ' 'NOTE: NO CHANGES TO REGISTRY OCCUR __UNLESS__ YOU CHANGE THE VALUE OF THE ' CONSTANT DO_WRITES to True just below this line '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Const DO_WRITES = False Const NEW_LIST = "\\Server1\c,\\Server1\d,\\Server1\e" Dim WshShell, gsKeyList, gsMainKey, objArgs, gsMsgLines, sMainArg, gsMyList Set WshShell = WScript.CreateObject("WScript.Shell") gsMainKey = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Map Network Drive MRU" gsKeyList = WshShell.RegRead(gsMainKey & "\MRUList") Set objArgs = WScript.Arguments If objArgs.count = 1 Then sMainArg = UCase(objArgs(0)) If Left(sMainArg,3)="DEL" Then Call DeleteThem(True) ElseIf Left(sMainArg,3)="SET" Then Call SetThem Else AccumLines "Called with the wrong arguments" AccumLines "##ECHO##" End If Else Call ListThem End If '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * '* SetThem - Sets the entries according to NEW_LIST entries '* NOTE: Nothing actually happens unless DO_WRITES = True above '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Sub SetThem Dim i,sChar,sValue,sCharList,aList AccumLines "==SETTING THE MRUList==" Call DeleteThem(False) aList = Split(NEW_LIST,",") sCharList = "" For i = 0 to UBound(aList) sChar = chr(97 + i) sValue = aList(i) sCharList = sCharList & sChar If DO_WRITES Then WshShell.RegWrite gsMainKey & "\" & sChar, sValue, "REG_SZ" End If AccumLines "Key [" & sChar & "] ==> [" & sValue & "]" Next AccumLines "Key [MRUList] ==> [" & sCharList & "]" If DO_WRITES Then WshShell.RegWrite gsMainKey & "\MRUList",sCharList, "REG_SZ" End If AccumLines "" AccumLines "DONE Sets" AccumLines "NOTE: You need to restart Windows now for these changes to take effect" AccumLines "##ECHO##" End Sub '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * '* DeleteThem - Deletes entries and empties MRUList string '* NOTE: Nothing actually happens unless DO_WRITES = True above '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Sub DeleteThem(ByVal OnlyDoingThis) Dim i, sChar AccumLines "==DELETING THE MRUList and other entries==" AccumLines "Registry Location:" AccumLines " " & gsMainKey AccumLines "MRUList = [" & gsKeyList & "]" For i = 1 To Len(gsKeyList) sChar = Mid(gsKeyList,i,1) If DO_WRITES Then WshShell.RegDelete gsMainKey & "\" & sChar End If AccumLines "Key [" & sChar & "] ==> DELETED" Next If DO_WRITES Then WshShell.RegWrite gsMainKey & "\MRUList","", "REG_SZ" End If AccumLines "Key [MRUList] ==> [empty]" AccumLines "" AccumLines "DONE Deletes" If OnlyDoingThis Then AccumLines "NOTE: You need to restart Windows now for these changes to take effect" AccumLines "##ECHO##" End If End Sub '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * '* ListThem - Lists the entries '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Sub ListThem Dim i, sChar, sValue AccumLines "==Simply Listing the Entries In The List==" AccumLines "Registry Location:" AccumLines " " & gsMainKey AccumLines "MRUList = [" & gsKeyList & "]" For i = 1 To Len(gsKeyList) sChar = Mid(gsKeyList,i,1) sValue = WshShell.RegRead(gsMainKey & "\" & sChar) AccumLines "Key [" & sChar & "] ==> [" & sValue & "]" Next AccumLines "" AccumLines "DONE Listing" AccumLines "NOTE: To Delete these entries you should open a command prompt and re-run it" AccumLines " like this:" AccumLines "C:\SomePath>CSCRIPT """ & Wscript.ScriptFullName & """ DEL" AccumLines " or:" AccumLines "C:\SomePath>CSCRIPT """ & Wscript.ScriptName & """ DEL" AccumLines " if you run it from the folder it's saved in." AccumLines "##ECHO##" End Sub '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * '* AccumLines -- accumulates lines to be displayed '* Why? When running a VBScript from Windows Explorer, it uses WSCRIPT.exe as '* the interpreter and Every call to WSCRIPT.Echo pops up a MsgBox '* But running the script via CSCRIPT.exe prints each WSCRIPT.Echo call to the '* command prompt console. '* So, by accumulating all info lines and echoing once it's more consistent '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Sub AccumLines(ByVal SomeText) If SomeText = "##ECHO##" Then Wscript.Echo gsMsgLines Else 'WScript.Echo "Accum: " & SomeText gsMsgLines = gsMsgLines & SomeText & vbLf End If End Sub

Dumphrey
Dumphrey

the actual map? I see your point though. Deleting by means of net use also clears out the registry keys though.

JCitizen
JCitizen

As soon as my Spyware Doctor subscription expires I am going back to it and enable auto-updates($9.95). It does a better job keeping Active X threats out of my honey pot than PCtools Spy-Dr. And lately those are some of the worst threats going. I have Active X set to prompt but so many sites I use need it and that Javacools wonder reduces the threat at least.

Betelgeuse58
Betelgeuse58

I'm still using it until I find a replacement that does the same thing. I tried A-A 2007, hated it and immediately reverted back to A-A se P. I update it manually with the files that Lavasoft provides for it here: http://www.lavasoft.com/support/securitycenter/blog/ Anyone know of a good simple free prog that is comparable to Ad-Aware se that would be a good replacement?

thomasboomer
thomasboomer

Here is a simple vbscript that does the same thing. To run it you can save it to your computer and double click the file. If it doesn't work, open a command prompt in the folder where you saved the file and run it using: cscript ClearMapNetworkDriveMRU.vbs Copy everything below this line... ' ' ' ClearMapNetworkDriveMRU.vbs ' ' Date: 06/18/2010. Author: Thomas Boomer ' The purpose of this program is to automatically clear the windows Explorer\Map Network Drive MRU and RunMRU. ' ' Application: ' This script is intended to be used in conjunction with preparing reference machines for imaging. For security reasons, it is desirable to not have a list of ' Most Recently Used UNC paths (MRUlist) stored within the image. This script removes the contents of the MRU lists from the registry. ' ' Background: ' MRU is Most Recently Used list. When you go to map a drive and you click the drop down list you will see a list of "remembered" network paths. ' This script will clear that drop down list. const HKCU = &H80000001 'HKEY CURRENT USER strComputer = "." Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _ strComputer & "\root\default:StdRegProv") strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Explorer\Map Network Drive MRU" 'Loop through Ascii codes a-z which is 97 to 122, and delete each corresponding registry value name For intAscval = 97 to 122 strStringValueName = (Chr(intAscval)) oReg.DeleteValue HKCU,strKeyPath,strStringValueName Next strStringValueName = "MRUList" strValue = "" oReg.SetStringValue HKCU,strKeyPath,strStringValueName,strValue ' ' End of file

Photogenic Memory
Photogenic Memory

I'm just kidding. All praise be to "copy and paste". This is an interesting script that calls to both VB script and Wscript? Cool beans! How long did it take you to prepare it? How long have you been working with vb and wscript? Can the task be done through a simpler language syntax? It's worth a shot, right? Oh, how quickly does the task run and how much processor resources does it take up?

JCitizen
JCitizen

replacing SS&D for one of the most effective anti-spyware utilities. Even if their Tea Timer can be replaced, I really don't think the anti-spyware and immunizer function can be done any better especially by freeware. AVG anti-spyware might come close, but PCtools Spyware Doctor is supposed to be the leading payware of its kind and the only thing about it that I find superior is the intelli-scanner, that saves you time when all you want is an intermediate weekly scan. I haven't found a free personal data protection blocker out there yet, and I am real worried about that because I doubt Trend has improved their product performance since IS 2006; but nothing else I've tried comes close in over all features and performance. The new Trend products like all the other big names just doesn't want to get along with any other utility and no one product can make it alone with the exception of Kasperski and ESET. And I have three beefs with them; so I will probably never switch to KAV anytime soon. I've been watching Softpedia, MajorGeeks, and download.com for a standalone data blocker but haven't found one yet. When you do a Google search all you get are posers who want to sell you something that doesn't work any different than the privacy filter in IE 7 Internet Options panel; and of course that doesn't cut it. With IS 2006 I've had crackers trying to scan and steal my social security number during chat sessions, and it blocked it every time. Now the newest cracking tech can get around this protection, but an infection like that is likely going to be blocked by Commodo because the spyware tries to use the wrong ports generally. Right now one of the most effective tactics I've used is simply keeping as many of my applications up to date as possible. Software vulnerabilities can be a common vector for the new sophisticated spyware coming out now. Secunia PSI(RC1) does a bang up job there and I highly recommend it![its free too] Also - have you tried Snoopfree Privacy Shield? This tool goes a long way in stopping any session keylogger or screen capture during a net session. A very simple utility that no one I've heard of has circumvented as of yet.

Betelgeuse58
Betelgeuse58

for explaining the SysFader [i]necessity[/i] thing for me, etc. Unfortunately, I can't afford to buy software any more so I must forgo the A-A Adwatch. I just have to try to find the best free-ware I can for now, at least. But it [b]is[/b] a comfort to me knowing that Comodo kinda picks up for T-T. I have Comodo Firewall installed in addition to the one in my router. I once had the Zone Alarm Suite that my ISP provides but, like you said it's like a seive the firewall does phone home as did the one in the Kaspersky Suite I tried. I guess I need to learn more about and find a data protection blocker, too. You have any ideas on where I should start? But I think that I'm going to replace A-A with either SUPERAntiSpyware, SpywareTerminator or Spyware Begone. Haven't made up my mind yet. Once Lavasoft gets A-A 2007 straighted out...IF they ever do, I guess I'll have no choice but to pick one of those three and go with it since they'll likely pull the manual updates for A-A se P altogether. May even replace SS&D for all I know at this moment in time. Again, thank you JC, for helping me out. :)

JCitizen
JCitizen

Some ISP processes and applications of other sorts need certain MRU's to function properly. It's no big deal as SS&D can restore files that are needed. If you want to keep SysFader and need to dump Tea Timer; A-A's AdWatch works as well I suspect. But you'd have to pay for it. I feel Comodo's Firewall Pro has a built in processes manager that works as well or better than Tea Timer. And has much better explanations of which ones are legitimate and what processes are trying to take over legitimate processes. An excellent teacher in how Windows runs things in the executive and registry arena. If you set it to low alerts(for newbies) you won't see as many, but you would miss a good learning opportunity. For freeware you can't beat it in leak tests; ZoneAlarm looks like a sieve compared to it. I will only use PC-cillin Internet Security 2006. When they drop it in 2009 I will just have to move to NOD32 I suppose. I just wish I could find a good substitute for data protection blocker that Trend had. The only phoning home I've seen from my AV programs is for auto-updates and that's it.

Betelgeuse58
Betelgeuse58

Thank you for the confirmation about CCleaner. I just haven't gotten the "Round Toit" to try CC yet. As I said, I'm still using A-A se - for now, at least. It does get MRUs that SS&D misses and does help speed up my machine. I don't understand the big deal about "needing" MRUs. What's there to "need" about them? I'm a home user and as far as I'm concerned all they are is/are file/s cluttering my H-D. My system automatically replaces the ones that it "needs", so there's no big deal to me in cleaning them out. The only possible problem with SS&D is one that has only just recently cropped up. I think that maybe the Tea Timer is messing up the SysFader. I've had XP ever since it first came out and have never had a SysFader problem before. My friend has SS&D on XP, too, and is having the same prob. We've both turned off the Tea Timer the other day and are waiting to see if the SysFader problem continues or not. So far, so good. But that means that we'll have to find a replacement for SS&D in addition to replacing A-A. :( BTW: I tried PC-cillin once. It came very close to crashing my puter! I had to uninstall it immediately. I tried this a couple of times and then decided to leave PCc alone. I even tried Kaspersky's 15 in one a couple of years ago. I found out that it was rootkitted and phoned home like Zone Alarm does (which I HATE!) and immediately uninstalled it. I can no longer afford to pay for progs that I can get free equivelants for any more, anyway. So I haven't a choice but to stay with the best free ones that I can find.

JCitizen
JCitizen

thing better and it cleans MRUs as well. But I'm getting somewhat off topic they clear ALL MRUs, you might have to set ignores on Spybot S&D to keep from losing ones you need. I suspect AdAware sold out to the spamming interests. It use to be a kick a** grayware remover that had a very good deep scanning capability and even worked better in safemode. I still deep scan with it at least every three months. Strangely enough it still seems to speed my browser sessions when the others stuff doesn't work. Lavasoft started lumping many objects together as "index data" files. The ID tags they use are somewhat cryptic to me. But anymore I end up using targeted tools for specific threats. The dividing line between grayware and viruses got so muddied that my PC-cillin IS 2006 AV suite has done a better job getting rid of or identifying suspicious files. Spybot Search & Destroy does just as good a job; maybe better; and it rids the system of MRUs also.

Photogenic Memory
Photogenic Memory

Perhaps I should invest sometime and learn it. It actually looks fun and really versatile! The reason I asked about how much resources it takes up is that I've heard that some languages like batch and bash shell scripts( which is something I'm trying to learn now ) can take a lot of resources until their finished. I've seen it in Bash. Even though computers are very fast now; you want to use a language that's quick like Perl, Python, C++, or even Basic? I'm probably not making sense and sound very amateur( which is true ). However, you do want to use a scripting langauge that makes low-level system calls and executes fast so as to not add extra overhead to production box for example? Perhaps it really doesn't matter. Thanks for the previos response. he script is inspiring. Thanks!

PJfromOttawa
PJfromOttawa

The language is VBScript and the entire script is a VBScript script. It gets interpreted by either WSCRIPT.exe (default) or CSCRIPT.exe (if you tell it to). Didn't take too long, been doing VBx for years. If you download the VBScript5.6 doc from MS, it has the entire reference for the language, etc. Simpler language syntax? If you find VBScript hard, you should stay away from these things. VBScript is about the "simplest" syntax you'll find. It runs virtually instantaneously. Processor resources? Who cares, it's a script. Run it with DO_WRITES=False (so nothing happens) and you'll see (once DO_WRITES=True it's still instantaneous)

Editor's Picks