Advertisement

Windows 10 Does Not Reconnect Mapped Network Drives [Fix]

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. Sometimes in Windows 10, mapped drives do not always automatically and reliably reconnect at logon. Let us see how to fix this issue.

Advertisеment

If a mapped network drive wasn't reconnected, any program that tries to access resources on the mapped network drive fails.

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.

Map Network Drive Wizard Windows 10

If you check 'Connect using different credentials', then you can specify a different user name and password.

The problem: When Windows 10 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.

To fix the issue Windows 10 Does Not Reconnect Mapped Network Drives, you need to do the following.

  1. Paste the following text inside Notepad and save as a *.cmd file.
    @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
    
    

    Replace the domainname\username portion with the appropriate values.
    Windows 10 Reconnect Mapped Drives

  2. In Notepad, press Ctrl + S or execute the File - Save item from the File menu. This will open the Save dialog. There, type or copy-paste the name "reconnect.cmd" including quotes. Double quotes are important to ensure that the file will get the "*.cmd" extension and not *.cmd.txt. You can save the file to any desired location.Windows 10 Save Batch File
  3. Move the *.cmd file you created to the Startup folder. Refer to the following article: How to add or remove startup apps in Windows 10. In short, press Win + R shortcut keys together and type the following into the Run box:
    shell:Startup

    This will open your Startup folder in File Explorer.Windows 10 Startup Folder

  4. Move the reconnect.cmd file there and you are done.

That's it. Many thanks to our reader "Jezze" for sharing this tip.

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: Sergey Tkachenko

Sergey Tkachenko is a software developer who started Winaero back in 2011. On this blog, Sergey is writing about everything connected to Microsoft, Windows and popular software. Follow him on Telegram, Twitter, and YouTube.

36 thoughts on “Windows 10 Does Not Reconnect Mapped Network Drives [Fix]”

  1. If you check reconnect at sign in, there’s a noticeable log in loading time even in high end machines. What I do is create a task schedule to map the network drive 1 minute time after log in.

    1. Would you care to share instructions on how to accomplish what you have done with the task scheduler? I tried looking into it and cannot figure it out. Thank you in advance.

  2. I’ve created a similar solution just check it out, it still needs a bit of work but can be configured and works great for me ;) https://github.com/thexmanxyz/network-share-reconnecter/

  3. Hi Sergey
    I am new to this.
    I have two network drives that will not reconnect. Your cmd works like a charm. Thanks.
    But I am only able to reconnect one of the drives. How will the cmd file look if i want to reconnect both a X: drive as well as a Z: drive?
    Regards

    1. Something like this
      @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
      :Start2
      timeout /t 5 /nobreak >NUL
      if exist Z:\NUL goto End2
      net use Z: \\server\share2 /USER:domainname\username /PERSISTENT:YES
      if ERRORLEVEL 1 goto Start2
      :End2

          1. how to get the X: \\server\share /USER:domainname\username /PERSISTENT:YES

            I meant to say the domainname and username

  4. Thank you. This solved the problem I was having with a scheduled batch file not finding the mapped drive it needed. Worked like a charm.

  5. Hi,

    Do I need to tweak this at all to include mapped drive passwords? Or does this script call on the credentials stored locally?

      1. I have copied the script and amended the server (naswhite) and username (paul). However when I log in to windows, a command prompt is waiting for me saying:

        The password or user name is invalid for \\naswhite\public.

        Enter the password for ‘Paul’ to connect to ‘naswhite’:

        I have double checked with windows credentials that the username is correct, even down to the case sensitivity. Do you have any idea why this is happening?

        Regards,
        Chris

        1. If it uses the password from the stored credentials, then that suggests to me that the username in the script doesn’t match the one stored locally. But I’ve checked, three, four times and they are the same. I have no idea what I’ve done wrong

          1. I have exactly the same issue, the credentials are correct, and yet it still prompt the first time

  6. Thank you much Sergey. I had to connect multiple drives and I just replicated the commands following the format..:Start2,3,4 etc. I also found that for drives on the domain that are public I did not need the../USER:domainname\username..line. I hope this helps others.

  7. I read your article with interest. My problem is different: I have a windows 10 pc and a symbology nas on a gigabit Ethernet. There are several shares attached as mapped drives with reconnect at logon ticked.

    If the nas boots up after the pc, programs cannot access the network drives until I use windows explorer to open the drives.

    Do you know of a way to have the pc automatically access the drives when the nas is booted after the pc?

  8. Hi Sergey
    I have a Western Digital “MyCloud” external hard drive networked with my Acer laptop. I use the WD to run scheduled backups of specific Acer data files during the nighttime hours. I have six (6) such scheduled backups and, accordingly, six (6) mapped networked drives on the WD external hard drive.

    Until one of the recent updates to Windows 10 these mapped network drives reconnected at startup…now they refuse to do so and I have to reconnect them manually. As a result, I’m looking at your solution. I’m currently on Windows 10 Pro, Version1809, Build 17763.503.

    Far as I can tell I’m NOT connected to nor affiliated to a “Domain” so I’m wondering how to modify your Code to accommodate the lack of a “Domain”…

    Your Code…
    if exist Z:\NUL goto End
    net use Z: \\server\share /USER:domainname\username /PERSISTENT:YES
    if ERRORLEVEL 1 goto Start

    My Code????????????….how to modify??????????
    if exist Z:\NUL goto End
    net use Z: \\server\share\MYUSERNAME /PERSISTENT:YES
    if ERRORLEVEL 1 goto Start

    I appreciate your input…John

    1. This worked for me…
      @echo off
      :Start
      timeout /t 5 /nobreak >NUL
      if exist Z:\NUL goto End
      net use Z: \\WDMYCLOUD\Sytem_Image /PERSISTENT:YES
      if ERRORLEVEL 1 goto Start
      :End
      :Start2
      timeout /t 5 /nobreak >NUL
      if exist Y:\NUL goto End2
      net use Y: \\WDMYCLOUD\Outlook /PERSISTENT:YES
      if ERRORLEVEL 1 goto Start2
      :End2
      :Start3
      timeout /t 5 /nobreak >NUL
      if exist X:\NUL goto End3
      net use X: \\WDMYCLOUD\Acer_New /PERSISTENT:YES
      if ERRORLEVEL 1 goto Start3
      :End3
      :Start4
      timeout /t 5 /nobreak >NUL
      if exist T:\NUL goto End4
      net use T: \\WDMYCLOUD\Predator /PERSISTENT:YES
      if ERRORLEVEL 1 goto Start4
      :End4
      :Start5
      timeout /t 5 /nobreak >NUL
      if exist N:\NUL goto End5
      net use N: \\WDMYCLOUD\FileHistory /PERSISTENT:YES
      if ERRORLEVEL 1 goto Start5
      :End5
      :Start6
      timeout /t 5 /nobreak >NUL
      if exist M:\NUL goto End6
      net use M: \\WDMYCLOUD\Quicken /PERSISTENT:YES
      if ERRORLEVEL 1 goto Start6
      :End6

    2. Hi John,
      For your username, just insert your (NAS) username. you don’t need a domain. if a password is needed, put that with a space after the username. so if your username was Jon and your password was qwerty, the line would read:

      net use Z: \\server\share\ /user:Jon qwerty /P:YES

      you only need to do the username and the /p (short for persistent) on the first one. the rest will follow the same setting. NOTE – you cant change usernames unless you remove all the shares…

  9. I looks like this will work fine, but what will happen if the network share really doesn’t exists, for example the network is down? Are we getting in an endless loop in this case?

  10. This works for the 6 mapped drives I need to connect. But the cmd window opens and it is blank. I close it. Seems ok, but annoying. Is there something I can include to close the window after?

      1. All the drives show as connected in the file explorer, but the cmd window remains open.
        Here is the contents of the file I created, perhaps I did something incorrectly:

        @echo off

        :Start
        timeout /t 5 /nobreak >NUL
        if exist X:\NUL goto End
        net use X: \\tst02s\Corporate /USER:TST\devinw /PERSISTENT:YES
        if ERRORLEVEL 1 goto Start
        :End
        :Start2
        timeout /t 5 /nobreak >NUL
        if exist X:\NUL goto End
        net use X: \\tst02s\Apps /USER:TST\devinw /PERSISTENT:YES
        if ERRORLEVEL 1 goto Start
        :End2
        :Start3
        timeout /t 5 /nobreak >NUL
        if exist X:\NUL goto End
        net use X: \\tst02s\Shared /USER:TST\devinw /PERSISTENT:YES
        if ERRORLEVEL 1 goto Start
        :End3
        :Start4
        timeout /t 5 /nobreak >NUL
        if exist X:\NUL goto End
        net use X: \\tst02s\TSTracker /USER:TST\devinw /PERSISTENT:YES
        if ERRORLEVEL 1 goto Start
        :End4
        :Start5
        timeout /t 5 /nobreak >NUL
        if exist X:\NUL goto End
        net use X: \\tst02s\Support /USER:TST\devinw /PERSISTENT:YES
        if ERRORLEVEL 1 goto Start
        :End5
        :Start6
        timeout /t 5 /nobreak >NUL
        if exist X:\NUL goto End
        net use X: \\192.168.1.120\TST Tracker Demo Data /USER:TST\devinw /PERSISTENT:YES
        if ERRORLEVEL 1 goto Start
        :End6

        1. Oh, looking at the example above the one I provided, I think I left of some of the numbers after the goto End and goto Start lines… I will add them in and see if that fixes it.

          1. Yeah, that was it. I changed it to:

            @echo off

            :Start
            timeout /t 5 /nobreak >NUL
            if exist X:\NUL goto End
            net use X: \\tst02s\Corporate /USER:TST\devinw /PERSISTENT:YES
            if ERRORLEVEL 1 goto Start
            :End
            :Start2
            timeout /t 5 /nobreak >NUL
            if exist X:\NUL goto End2
            net use X: \\tst02s\Apps /USER:TST\devinw /PERSISTENT:YES
            if ERRORLEVEL 1 goto Start2
            :End2
            :Start3
            timeout /t 5 /nobreak >NUL
            if exist X:\NUL goto End3
            net use X: \\tst02s\Shared /USER:TST\devinw /PERSISTENT:YES
            if ERRORLEVEL 1 goto Start3
            :End3
            :Start4
            timeout /t 5 /nobreak >NUL
            if exist X:\NUL goto End4
            net use X: \\tst02s\TSTracker /USER:TST\devinw /PERSISTENT:YES
            if ERRORLEVEL 1 goto Start4
            :End4
            :Start5
            timeout /t 5 /nobreak >NUL
            if exist X:\NUL goto End5
            net use X: \\tst02s\Support /USER:TST\devinw /PERSISTENT:YES
            if ERRORLEVEL 1 goto Start5
            :End5
            :Start6
            timeout /t 5 /nobreak >NUL
            if exist X:\NUL goto End6
            net use X: \\192.168.1.120\TST Tracker Demo Data /USER:TST\devinw /PERSISTENT:YES
            if ERRORLEVEL 1 goto Start6
            :End6

            Works great now, thank you!

  11. Why don’t you try another way? following example:

    @echo off

    :Start
    timeout /t 5 /nobreak >NUL
    if not exist Z:\ (net use Z: \\MediaCenter\Anime /PERSISTENT:YES) else ( ECHO “Z:/ Exists”)
    if not exist W:\ (net use W: \\MediaCenter\Videos /PERSISTENT:YES) else ( ECHO “W:/ Exists”)
    if not exist X:\ (net use X: “\\MediaCenter\TV Shows” /PERSISTENT:YES) else ( ECHO “X:/ Exists”)
    if not exist Y:\ (net use Y: \\MediaCenter\SpyPower /PERSISTENT:YES) else ( ECHO “Y:/ Exists”)
    if ERRORLEVEL 1 goto Start
    :End

  12. I have an issue whereby once i switch on my PC ( it shows not connected to shared network ), once i restart the PC, i am connected again. Why is this happening ? Possible to use your cmd coding to solve my current issue ?

  13. I need a little help?

    Client calls in and says that all the shared drives are offline, what would you NOT do?  

  14. A nice solution using PowerShell that automatically looks up your mapped drives.

    https://support.microsoft.com/en-us/help/4471218/mapped-network-drive-may-fail-to-reconnect-in-windows-10-version-1809

  15. This is awesome. You’re my hero! I’ve created a looped version instead for my users to make it easier to add/remove drives that they use, and to attempt each drive a few times because our servers are slow.

    SET Q_drive=company Q-drive path
    SET O_drive=company O-drive path
    SET N_drive=company N-drive path
    SET K_drive=company K-drive path

    :Start

    SET current_drive=Q
    SET current_path=%Q_drive%
    SET next_drive=O

    echo Checking network drives…
    echo/

    :Loop
    ::Attempt to connect 5 times
    FOR /L %%a in (1,1,5) do (

    IF exist %current_drive%:\NUL (
    echo %current_drive% Drive connected
    echo/
    goto %next_drive%
    )

    echo %current_drive% Drive not connected. Attempting to reconnect…
    echo Attempt %%a/5

    net use %current_drive%: %current_path% /PERSISTENT:YES >NUL 2>&1
    timeout /t 3 /nobreak >NUL
    )

    ::if didn’t jump out of loop, then drive not available
    echo %current_drive% Drive not available
    echo/
    goto %next_drive%

    :O
    SET current_drive=O
    SET current_path=%O_drive%
    SET next_drive=N
    goto Loop

    :N
    SET current_drive=N
    SET current_path=%N_drive%
    SET next_drive=K
    goto Loop

    :K
    SET current_drive=K
    SET current_path=%K_drive%
    SET next_drive=Show_Results
    goto Loop

    :Show_Results
    ::delay before closing window to display results
    timeout /t 3 /nobreak >NUL

    :End

Leave a Reply

Your email address will not be published.

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