With the new Windows 1909 update we got some nice fixes of crucial issues with Windows 10, but also got a few new bugs. For me, probably the most annoying one is that with every boot all of my 20 network drives are marked as offline. Now the fix is easy, just pop them open with your explorer, and the notification (could not reconnect all network drives) goes away, but doing that for all of them is a bit annoying. Now Microsoft is aware of the issue and has marked it to be fixed within the next updates, but until then here is a small script that will find and open (as well as close) those drives for you and make the notification go away.
Just save the bellow script as ANYTHING.bat save it to your PC and either add it to your startup menu or just leave it on your desktop to click when you need to.
@echo off setlocal enabledelayedexpansion echo Auto reconnect all offline network drives echo Slurp-Ramen.com April 2020 echo https://slurp-ramen.com echo . echo Waiting for your network set LC=0 goto :waitfornet_ :waitfornet timeout /t 1 /NOBREAK >nul :waitfornet_ route print -4 | findstr /C:" 0.0.0.0 " >nul 2>nul if not errorlevel 1 goto :NetReady set /A LC=%LC%+1 if %LC% LSS 30 goto :waitfornet goto :eof :NetReady echo . echo Network online timeout /t 5 /nobreak >nul goto :RefreshNetDrives :RefreshNetDrives echo . echo Searching for offline drives: set "OfflineNetDrives_cnt=0" net use | findstr /b /v OK |findstr "A:" if not errorlevel 1 ( set /a OfflineNetDrives_cnt+=1 set "OfflineNetDrives[!OfflineNetDrives_cnt!]=A:" ) net use | findstr /b /v OK |findstr "B:" if not errorlevel 1 ( set /a OfflineNetDrives_cnt+=1 set "OfflineNetDrives[!OfflineNetDrives_cnt!]=B:" ) net use | findstr /b /v OK |findstr "C:" if not errorlevel 1 ( set /a OfflineNetDrives_cnt+=1 set "OfflineNetDrives[!OfflineNetDrives_cnt!]=C:" ) net use | findstr /b /v OK |findstr "D:" if not errorlevel 1 ( set /a OfflineNetDrives_cnt+=1 set "OfflineNetDrives[!OfflineNetDrives_cnt!]=D:" ) net use | findstr /b /v OK |findstr "E:" if not errorlevel 1 ( set /a OfflineNetDrives_cnt+=1 set "OfflineNetDrives[!OfflineNetDrives_cnt!]=E:" ) net use | findstr /b /v OK |findstr "F:" if not errorlevel 1 ( set /a OfflineNetDrives_cnt+=1 set "OfflineNetDrives[!OfflineNetDrives_cnt!]=F:" ) net use | findstr /b /v OK |findstr "G:" if not errorlevel 1 ( set /a OfflineNetDrives_cnt+=1 set "OfflineNetDrives[!OfflineNetDrives_cnt!]=G:" ) net use | findstr /b /v OK |findstr "H:" if not errorlevel 1 ( set /a OfflineNetDrives_cnt+=1 set "OfflineNetDrives[!OfflineNetDrives_cnt!]=H:" ) net use | findstr /b /v OK |findstr "I:" if not errorlevel 1 ( set /a OfflineNetDrives_cnt+=1 set "OfflineNetDrives[!OfflineNetDrives_cnt!]=I:" ) net use | findstr /b /v OK |findstr "J:" if not errorlevel 1 ( set /a OfflineNetDrives_cnt+=1 set "OfflineNetDrives[!OfflineNetDrives_cnt!]=J:" ) net use | findstr /b /v OK |findstr "K:" if not errorlevel 1 ( set /a OfflineNetDrives_cnt+=1 set "OfflineNetDrives[!OfflineNetDrives_cnt!]=K:" ) net use | findstr /b /v OK |findstr "L:" if not errorlevel 1 ( set /a OfflineNetDrives_cnt+=1 set "OfflineNetDrives[!OfflineNetDrives_cnt!]=L:" ) net use | findstr /b /v OK |findstr "M:" if not errorlevel 1 ( set /a OfflineNetDrives_cnt+=1 set "OfflineNetDrives[!OfflineNetDrives_cnt!]=M:" ) net use | findstr /b /v OK |findstr "N:" if not errorlevel 1 ( set /a OfflineNetDrives_cnt+=1 set "OfflineNetDrives[!OfflineNetDrives_cnt!]=N:" ) net use | findstr /b /v OK |findstr "O:" if not errorlevel 1 ( set /a OfflineNetDrives_cnt+=1 set "OfflineNetDrives[!OfflineNetDrives_cnt!]=O:" ) net use | findstr /b /v OK |findstr "P:" if not errorlevel 1 ( set /a OfflineNetDrives_cnt+=1 set "OfflineNetDrives[!OfflineNetDrives_cnt!]=P:" ) net use | findstr /b /v OK |findstr "Q:" if not errorlevel 1 ( set /a OfflineNetDrives_cnt+=1 set "OfflineNetDrives[!OfflineNetDrives_cnt!]=Q:" ) net use | findstr /b /v OK |findstr "R:" if not errorlevel 1 ( set /a OfflineNetDrives_cnt+=1 set "OfflineNetDrives[!OfflineNetDrives_cnt!]=R:" ) net use | findstr /b /v OK |findstr "S:" if not errorlevel 1 ( set /a OfflineNetDrives_cnt+=1 set "OfflineNetDrives[!OfflineNetDrives_cnt!]=S:" ) net use | findstr /b /v OK |findstr "T:" if not errorlevel 1 ( set /a OfflineNetDrives_cnt+=1 set "OfflineNetDrives[!OfflineNetDrives_cnt!]=T:" ) net use | findstr /b /v OK |findstr "U:" if not errorlevel 1 ( set /a OfflineNetDrives_cnt+=1 set "OfflineNetDrives[!OfflineNetDrives_cnt!]=U:" ) net use | findstr /b /v OK |findstr "V:" if not errorlevel 1 ( set /a OfflineNetDrives_cnt+=1 set "OfflineNetDrives[!OfflineNetDrives_cnt!]=V:" ) net use | findstr /b /v OK |findstr "W:" if not errorlevel 1 ( set /a OfflineNetDrives_cnt+=1 set "OfflineNetDrives[!OfflineNetDrives_cnt!]=W:" ) net use | findstr /b /v OK |findstr "X:" if not errorlevel 1 ( set /a OfflineNetDrives_cnt+=1 set "OfflineNetDrives[!OfflineNetDrives_cnt!]=X:" ) net use | findstr /b /v OK |findstr "Y:" if not errorlevel 1 ( set /a OfflineNetDrives_cnt+=1 set "OfflineNetDrives[!OfflineNetDrives_cnt!]=Y:" ) net use | findstr /b /v OK |findstr "Z:" if not errorlevel 1 ( set /a OfflineNetDrives_cnt+=1 set "OfflineNetDrives[!OfflineNetDrives_cnt!]=Z:" ) echo !OfflineNetDrives_cnt! Found offline drives echo . echo Reconnecting all offline drives: for /L %%n in (1 1 !OfflineNetDrives_cnt!) DO ( echo !OfflineNetDrives[%%n]! & Start /min explorer "!OfflineNetDrives[%%n]!") goto :CleanUp :CleanUp timeout /t 5 /nobreak >nul echo . echo Exiting all windows opened for /L %%n in (1 1 !OfflineNetDrives_cnt!) DO ( for /f "tokens=2 delims=," %%a in ('tasklist /fi "imagename eq explorer.exe" /v /fo:csv /nh ^| findstr /r "!OfflineNetDrives[%%n]!"') do (echo !OfflineNetDrives[%%n]! & taskkill /pid %%a) ) echo . echo Done timeout /t 5 /nobreak >nul
Nice Script 🙂
One Issue i still have, the script dosent reconnect a Home Folder that is located on a Fileserver.
How can i fix this issue? All other network drives are reconecting with your script properly. The remote home folder dosent
thank you
Probably the “Home Folder” you are mentioning is not designated as a drive letter in this script. Just replace the findstr “Z:” and “OfflineNetDrives[!OfflineNetDrives_cnt!]=Z:” part of the script with the name of your device (the example is if it’s called Z:
Hope it helps!