Categories :

Mapped Drives not reconnecting at startup – Windows 10, and Windows 11 – Solved

Background… I’ve had problems for years where the mapped network drives would not reconnect during the startup of windows. I’ve searched the internet and found numerous articles explaining how to solve the issue. None of them worked for me.

Recently I started playing with Raspberry pi’s and set one up as a NEMS system to monitor my home network, plus a few sites like,, so I could see if anything went down, or had issues, on my home network and if my broadband was suffering from downtime.

This created a Folder on the network called NEMS/Backup. I mapped this folder, so ended up with

Backup (\\NEMS) (X)

Every time I started Windows, this drive was mapped and connected without any errors.

This got me thinking about my NAS (Network Attached Storage) and why it wouldn’t stay connected, and if there was a way I could keep it connected. The NAS in question is an old DLink DNS320L.

I finally decided that if I disconnect the network drives during startup, and then connect the drives, it would work. So this is my method, whilst not very elegant, it worked. Copy the following text into a file and rename the file MapNetworkDrives.bat

:: Author Kevin B Agar
:: Date 3rd November 2021
:: Batch file to map network drives at startup
:: Create a log file
set LOGFILE=C:\logs\MapNetworkDrives.log
echo %date% %time% >> C:\logs\MapNetworkDrives.log
call :LOG >> %LOGFILE%
exit /B
:: Remove any network drives
net use Y: /delete
net use Z: /delete
:: Map network drives
net use Y: “\\Volume_1”
net use Z: “\\My Documents”
:: Place the file in %ProgramData%\Microsoft\Windows\Start Menu\Programs\StartUp

The :: are comments.

set LOGFILE=C:\logs\MapNetworkDrives.log sets the location of the log file, change as required

call :LOG >> %LOGFILE% The >> causes the new entries into the log file to be added to the end. If you want to just have the latest information in the log file then just use a single >

net use Y: /delete Change this to the drive letter you want to unmap. Add as many drives as required.

net use Y: “\\Volume_1” Change this to the drive letter you want to map the network drive to. You can change the IP address to the Network name, for example, net use Y: “\NETDRIVE\Volume_1”, and add as many drives as you want.

Save the file and place it in %ProgramData%\Microsoft\Windows\Start Menu\Programs\StartUp

This worked every time, but it flashed up a command window on the screen which wasn’t very pretty. To get around this I created a visual basic file to run the batch file and named it MapNetworkDrives.vbs.

Set WshShell = CreateObject(“WScript.Shell” )
WshShell.Run chr(34) & “C:\Scripts\MapNetworkDrives.bat” & Chr(34), 0
Set WshShell = Nothing

This file was place in %ProgramData%\Microsoft\Windows\Start Menu\Programs\StartUp and the file MapNetworkDrives.bat was placed in the folder C:\Scripts

Now every time the PC was started it ran the file MapNetworkDrives.vbs which called the batch file MapNetworkDrives.bat which deleted all mapped drives, then mapped all network drive and wrote this into the log file, all silently

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.