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.
- 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.
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.
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.
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
}
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
).
- Create a new task, specify its name (reMapNetworkDrives), select that the task needs to be run on behalf of the Builtin\Users group;
- On the Triggers tab, select that the task should run when any user logs on to the system (At logon -> Any user);
- On the Actions tab, in the Program/script field, specify the path to the MapDrives.cmd file;
- On the Conditions tab you can enable the options Network -> Start only if the following network connection is available -> Any connection;
- 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.
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
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
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.
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.
6 comments
KB4469342 – fix for the Mapped Network drive bug in Windows 10 1809:
Addresses an issue that may cause mapped drives to fail to reconnect after starting and logging onto a Windows device
I got the solution of WIndows 10 map network drive connect.
Please install MediaCreationTool1809 and switch on firewell setting. then restart your system.
You’ll got activate your map network drive.
This does not work at all.
i tried and its working
install https://go.microsoft.com/fwlink/?LinkId=691209
MediaCreationTool1809 and install it after installation just check your network setting and allowed to network sharing.
now check it’s work fine.
Here it is March 2021 and I’m landing back on this page, so obviously Microsoft as usual can’t make a fix and keep it fixed. This one described above actually worked for me. One tweak I had to discover on my own was to ensure the user credentials were added as windows credentials. Group policy notes above should be called out as not available without additional hacking up windows on home edition. I just don’t get how microsoft can’t do the simple things reliably in this day and age. Power plan settings, need I say more.
In my opinion, the problem will be solved if you add a .bat file in the boot menu and use the “net use” command with the “/ persistent: no” option. This will cause that the disk will not be remembered after logging out, but added again every time you log in. In my case, WIN10 no longer causes a drive mapping error.