Windows OS Hub
  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu

 Windows OS Hub / Windows 10 / Could not Reconnect All Mapped Network Drives on Windows 10

May 6, 2021 Windows 10

Could not Reconnect All Mapped Network Drives on Windows 10

Recent builds of Windows 10 have a bug due to which mapped network drives may fail to automatically reconnect at Windows startup. After logging in the user sees a big red cross on the icons of all mapped network drives in File Explorer. If you run the net use command in the command prompt, then you will see the Unavailable status in front of all mapped drives. Both user-mapped network drives and GPO-mapped drives are not automatically reconnected.

This issue first appeared on Windows 10 1809, but it occurs in newer builds, including Windows 10 2004.

Contents:
  • Mapped Network Drives Not Reconnecting in Windows 10
  • Auto Reconnect Mapped Network Drives using PowerShell
  • Automatic Reconnection of Mapped Drives via GPO
  • Mapped Network Drive May Fail to Reconnect on Windows 10 2004 (20H2)
  • Delay Mapping Network Drives in Windows via GPO
  • Disable Could Not Reconnect All Network Drives Notification

Mapped Network Drives Not Reconnecting in Windows 10

Windows 10 for some reason stops automatically mapping network drives after restarting the device. Mapped network drives are displayed in File Explorer, but you cannot connect to them.

A red "X" appears in the icon for a mapped network drive in windows 10 18093

In this case, a pop-up window appears in the notification area with the alert:

Could not reconnect all network drives.
Click here to check the status of your network drives.

Could not reconnect all network drives in windows 10

The problem occurs both with mapped drives connected from NAS devices, and with shared folders on other Windows / Linux computer. This bug first appeared in Windows 10 version 1809 and, according to Microsoft, was fixed by the KB469342 update released on December 5, 2018 (addresses an issue that may cause mapped drives to fail to reconnect after starting and logging onto a Windows device). But the problem occurs in new Windows 10 builds as well.

You can manually download and install the update from the Microsoft Update Catalog.

Microsoft also offers a workaround to the problem of restoring connectivity to the mapped network drives (see KB4471218 — Mapped network drive may fail to reconnect in Windows 10, version 1809). To do this, it is suggested to run a PowerShell script at user logon. If network drives are connected via Group Policy, you need to change the GPO settings.

Auto Reconnect Mapped Network Drives using PowerShell

Let’s look at how to use a PowerShell script to automatically reconnect mapped network drives when a user logs on to Windows.

Run the notepad.exe, copy the following PowerShell code into it, and save the file to the C:\PS directory as MapDrives.ps1:

$i=3
while($True){
$error.clear()
$MappedDrives = Get-SmbMapping |where -property Status -Value Unavailable -EQ | select LocalPath,RemotePath
foreach( $MappedDrive in $MappedDrives)
{
try {
New-SmbMapping -LocalPath $MappedDrive.LocalPath -RemotePath $MappedDrive.RemotePath -Persistent $True
} catch {
Write-Host "Shared folder connection error: $MappedDrive.RemotePath to drive $MappedDrive.LocalPath"
}
}
$i = $i - 1
if($error.Count -eq 0 -Or $i -eq 0) {break}
Start-Sleep -Seconds 30
}

MapDrives.ps1: powershell script to reconnect mapped drives

This script selects all inaccessible mapped drives and tries to reconnect them in persistent mode.

Create another MapDrives.cmd script file with the following code:
PowerShell -Command "Set-ExecutionPolicy -Scope CurrentUser Unrestricted" >> "%TEMP%\StartupLog.txt" 2>&1
PowerShell -File "%SystemDrive%\PS\MapDrives.ps1" >> "%TEMP%\StartupLog.txt" 2>&1

This code allows you to bypass the PowerShell execution policy and run the PS1 script described above. You can put this batch file into the user’s startup by copying the MapDrives.cmd file to the %ProgramData%\Microsoft\Windows\Start Menu\Programs\StartUp folder.

You can also create a scheduled task to run the MapDrives.cmd file when a user logs on. You can create a scheduler task using PowerShell or from the Task Scheduler GUI console (Taskschd.msc).

  1. Create a new task, specify its name (reMapNetworkDrives), select that the task needs to be run on behalf of the Builtin\Users group; reMapNetworkDrives using task Scheduler
  2. On the Triggers tab, select that the task should run when any user logs on to the system (At logon -> Any user);
  3. On the Actions tab, in the Program/script field, specify the path to the MapDrives.cmd file;
  4. On the Conditions tab you can enable the options Network -> Start only if the following network connection is available -> Any connection; Start task only if the following network connection is available
  5. Reboot the computer or logoff/logon under your user account. When the user logs in, the script should run, which will re-create all mapped drive connections.
Please note that by default network drives connected in the elevated mode are not available in normal mode and vice versa. But you can fix it – see the article Mapped drives are not available from the elevated apps.

Automatic Reconnection of Mapped Drives via GPO

If you map network drives to users using domain Group Policies, you need to change the policy settings in order to connect the drives correctly.

Open the GPO that connects the drives, and in the section User Settings -> Preferences -> Windows Settings -> Drive maps, find your network drive assignment policy (policies) and change the Action type from Update to Replace

GPP policy to map shared network folders to drive

After updating the Group Policy settings on clients, the mapped network drives will be removed and reconnected when the user logs on.

Mapped Network Drive May Fail to Reconnect on Windows 10 2004 (20H2)

The problem with mapping network drives also occurs on Windows 10 2004 (build 20H2). The problem arises with network drives connected from legacy network devices that support only the SMBv1 protocol (Windows XP/2003, old NAS devices).

In order to fix this problem, you need to add the parameter ProviderFlags=1 to the user registry for each mapped network drive.

For example, if the user has a network drive U: mapped in the session, go to the registry key HKEY_CURRENT_USER\Network\U. Create a DWORD named ProviderFlags with a value of 1.

Or run the command:

REG ADD "HKCU\Network\U" /v "ProviderFlags" /t REG_DWORD /d "1" /f

map network drives from smbv1 devices with the ProviderFlags registry parameter

Delay Mapping Network Drives in Windows via GPO

Windows may try to reconnect network drives at user logon before the network interface is fully initialized. To prevent mapped drives from connecting until the network is fully enabled, you can configure a specific Group Policy setting.

You can configure this setting through the Local Group Policy Editor (gpedit.msc) or from the Domain GPO Editor (gpmc.msc). Go to Computer Configuration -> Administrative Templates -> System -> Logon and enable the Always wait for the network at computer startup and logon policy.

enable windows gpo parameter "Always wait for the network at computer startup and logon"

Reboot your computer.

You can also fix this problem if you just wait 15 seconds after booting your computer (or exiting from the hibernation/sleep mode) before logging in. This time will be sufficient for Windows to initialize the network.

Disable Could Not Reconnect All Network Drives Notification

If your computer is located not on the corporate network (network drives are not available by design), and you are bothered by the annoying “Could not reconnect all network drives” notification every time Windows boots, you can disable it.

To do this, go to the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\NetworkProvider, and create a new DWORD parameter with the name RestoreConnection and value 0.

disabling couldnt reconnect network drives notification on windows 10

6 comments
2
Facebook Twitter Google + Pinterest
previous post
Parted: Create and Manage Disk Partitions on Linux
next post
Using PowerShell Just Enough Administration (JEA) to Delegate Privileges to Non-Admin Users

Related Reading

Configuring Event Viewer Log Size on Windows

May 24, 2023

How to Detect Who Changed the File/Folder NTFS...

May 24, 2023

How to Create, Change, and Remove Local Users...

May 17, 2023

Fix: BSOD Error 0x0000007B (INACCESSABLE_BOOT_DEVICE) on Windows

May 16, 2023

View Success and Failed Local Logon Attempts on...

May 2, 2023

Categories

  • Active Directory
  • Group Policies
  • Exchange Server
  • Microsoft 365
  • Azure
  • Windows 11
  • Windows 10
  • Windows Server 2022
  • Windows Server 2019
  • Windows Server 2016
  • PowerShell
  • VMWare
  • Hyper-V
  • Linux
  • MS Office

Recent Posts

  • Configuring Event Viewer Log Size on Windows

    May 24, 2023
  • How to Detect Who Changed the File/Folder NTFS Permissions on Windows?

    May 24, 2023
  • Enable Single Sign-On (SSO) Authentication on RDS Windows Server

    May 23, 2023
  • Allow Non-admin Users RDP Access to Windows Server

    May 22, 2023
  • How to Create, Change, and Remove Local Users or Groups with PowerShell?

    May 17, 2023
  • Fix: BSOD Error 0x0000007B (INACCESSABLE_BOOT_DEVICE) on Windows

    May 16, 2023
  • View Success and Failed Local Logon Attempts on Windows

    May 2, 2023
  • Fix: “Something Went Wrong” Error When Installing Teams

    May 2, 2023
  • Querying Windows Event Logs with PowerShell

    May 2, 2023
  • Configure Windows LAPS (Local Administrator Passwords Solution) in AD

    April 25, 2023

Follow us

  • Facebook
  • Twitter
  • RSS
Popular Posts
  • How to Allow Multiple RDP Sessions in Windows 10 and 11?
  • How to Repair EFI/GPT Bootloader on Windows 10 or 11?
  • How to Restore Deleted EFI System Partition in Windows?
  • Network Computers are not Showing Up in Windows 10/11
  • Updating List of Trusted Root Certificates in Windows
  • How to Create a Wi-Fi Hotspot on your Windows PC?
  • How to Sign an Unsigned Device Driver in Windows?
Footer Logo

@2014 - 2023 - Windows OS Hub. All about operating systems for sysadmins


Back To Top