Advertisement

FIX: Windows does not reconnect to mapped network drives

If you have a home or work network set up for your Windows PC, you may also be mapping network shares to drive letters. Mapped drives are very convenient as they allow accessing network files and folders just like a regular local drive. However, in modern versions of Windows, there is a problem that mapped drives do not always automatically and reliably reconnect at logon. So any program that tries to access resources on the mapped network drive fails. Let us see how to fix this issue.

Advertisеment

When you create a mapped network drive, there is an option 'Reconnect at logon' which you can check so that every time Windows logs on, they are automatically mounted using the current user's logon credentials. If you check 'Connect using different credentials', then you can specify a different user name and password.

When Windows logs on, there is a timing issue which causes it to attempt to map the network drives before the network is available. This results in them being unavailable sometimes. If you press Refresh in Windows Explorer or double click the drive, they instantly become available.

This is the error you get sometimes because Windows cannot reliably map network drives "Could not reconnect all network drives."
MappedError

Zorn Software's MapDrive.exe to the rescue

This is nothing but a timing issue. Windows tries to map the network drives too early in the logon process and that is the reason they fail. A third party program called MapDrive.exe fixes this by repeatedly attempting to create the mapping until a specified timeout is reached. Because it uses repeated attempts, it is successful every time you log on.

  1. Download MapDrive from this page.
  2. Copy the EXE to some location in your system path. For example, C:\Windows
  3. Press the Win+R keys together on your keyboard and type: shell:startup. Press Enter. This will open your Startup folder.
  4. Right click in an empty area of File Explorer -> New -> Shortcut and create a shortcut with the following syntax:
    <Path to MapDrive.exe> <DriveLetter> <\\ServerName\ShareName> <TimeoutInSeconds> [Username] [Password]

    For example, if the drive letter you assigned is Z:, specify the following as the shortcut target:

    C:\Windows\MapDrive.exe Z: \\Windows-PC\DriveZ 20

    This will map the network share called 'DriveZ' on the remote computer named 'Windows-PC' to the drive letter Z: and will keep attempting to map it for 20 seconds.

  5. The user name and password are optional for MapDrive.exe's command line. You could also specify them while mapping them from Explorer and then only use the timeout in the shortcut.

This fixes the issue of network drives not reconnecting reliably at logon. You may still get the error message after you log on that it couldn't automatically reconnect but as startup items load, the error will go away when MapDrive.exe successfully reconnects to the share. If you are annoyed by this error message, you can hide it from Control Panel -> Notification Area Icons.

Making mapped drives available to programs that run as admin

In modern versions of Windows, the drives which you map are not available to programs that run as administrator because of the concept of split security token. So you must create the same shortcut to run as administrator at startup. Just use Winaero's ElevatedShortcut tool to create another shortcut in the startup folder as we previously showed. As long as this startup is placed in the Startup folder, the drives will be mapped for administrator level programs too.
ES MapDrive

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!

Advertisеment

Author: Gaurav Kale

Gaurav is a software enthusiast from India and Classic Shell tester & UX consultant. He started with Windows 95 and is good at software usability testing. He firmly believes that user experience is just as important as software code quality and architecture for software to be successful.

13 thoughts on “FIX: Windows does not reconnect to mapped network drives”

  1. I don’t see why you need a third party tool, when you could use an onboad tool for this.
    Just create a batch file in the startup folder, insert the following command and you achieve the same result:

    c:\windows\system32\net.exe use z: “\\netshare\folder” password /user:username

    Instead i have two other difficulties with network shares.

    First. I can’t reconnect them after i wake up my PC from standby mode.
    At least not the ones with different usernames than the username, that i am currently logged in with. I can’t even connect to them with the “net use” command again.

    Second. Windows likes to doubly assign drive letters of changeable storage devices and mapped network shares.
    If you format an usb drive on another pc and assign it to drive letter z:, then insert it into your pc, where drive letter z: is mapped to a network share they both have the same letter and you won’t be able to access the usb drive.
    I already wrote a little programm, that unmounts every drive letter from every changeable device found and remounts them under new free drive letters. It’s not perfect though, because it doesn’t work on USB sticks which use SATA bridge chip controllers and over all it’s implementation is pretty crappy. It’s one big hack using the mountvol command and parsing it’s results. I’d love to know if there is a better solution.

    1. You need the third party tool, mapdrive.exe because it makes multiple attempts to connect for the specified timeout until it succeeds. If you try to run net use early on during the logon procedure, it will also fail with error code ERROR_FILE_NOT_FOUND – basically, it is unable to contact the network path. The WNetAddConnection2 function also fails if you use it early in the logon process.

      For your first problem, open Event Viewer and look for an event in the System log that gets logged when your PC resumes from standby. It will be something like “The system has returned from a low power state.” (Event ID 1 from the Power Troubleshooter). You can right click it and attach a Task to this event which will run every time your PC resumes from standby. Again, I feel since net use doesn’t work in this case, mapdrive.exe will work if the share was working earlier before your PC went to sleep.

      For your second problem, use USB Drive Letter Manager: http://www.uwe-sieber.de/usbdlm_e.html

      1. You do NOT need a special “tool” just to “delay 10 secs” nor “try 5 times”.
        Ugh.
        A simple script can do all that and so much more.
        You do not need to install 120 copies of a “special tool” on your 120 office computers.

        1. Sure wise guy. Why don’t you share your wonderful script that you have been hiding from everyone? Let’s see how good it works.

          1. I am in a *highly* regulated, *highly* audited environment. I cannot simply run a 3rd party tool. If I even suggested this tool to InfoSec, I’d be handed a box with my coffee cup and family photos and stripped of my badge.

            I’m sure the code for “MapDrive.exe” isn’t going to net you millions of dollars and a buyout offer from Microsoft. So if you could share the magic behind the .exe file, that would be helpful.

          2. @echo off

            :Start
            timeout /t 5 /nobreak >NUL
            if exist X:\NUL goto End
            net use X: \\server\share /USER:domainname\username /PERSISTENT:YES
            if ERRORLEVEL 1 goto Start
            :End

  2. We map are drives using a batch file still in the GPO. I only seem to be having this issue of drives not always remapping for the Surface tablets we have. For those users I just copied the batch file to their desktop and told them to run it when needed. I tried mapping the drive the newer way using GPO but for the Windows 8.1 systems I test it on when the use went home they had no drives mapped. It works great in the office but not for mobile users.

  3. I had the annoying “Could not reconnect all network drives” on start up and restart for ages and nothing posted seemed to help. I then saw that the Windows 10TP which I dual booted didn’t map my NAS, but added it as a Network Location, result being no annoying “Could not reconnect all network drives”. This solution obviously will not help anyone who needs a Drive Letter for their networked drive, but suits me and a few others I bet. The “Add network location wizard” is well documented on Microsoft website and others.

  4. RUN gpedit.mssc, GoTo Computer Configuration > Adminstrative Templates > System > Logon, here you’ll find “Always wait for the network at computer startup and logon”. Enable it and problem solved.

  5. I have one NAS with seven different mapped drives. It would be nice to have that in one shortcut instead of 8 shortcuts.

  6. I created a similar solution but does not require a 3rd party software and MapDrive seems to be quite old and unsupported. My solution depends on a VBS script and only uses default windows apps and commands. It relies on simple commands like “net use” and “ping”. Take a look on the project page and how you can use it to automatically reconnect existing network drives on logon or resume:

    https://github.com/thexmanxyz/network-share-reconnecter

Leave a Reply

Your email address will not be published.

css.php
Using Telegram? Subscribe to the blog channel!
Hello. Add your message here.