This happens during login when a networked drive attempts to reconnect before the network is available. Mapped network drives are displayed as Unavailable and a red X appears on the drives.
This is fixed with Group Policy.
1) Open the Group Policy Editor and navigate to Computer Configuration → Administrative Templates → System → Logon → Always wait for the network at computer startup and logon
2) Edit the policy enabling it.
3) Create a script file named MapDrives.cmd and insert the following.
PowerShell -Command "Set-ExecutionPolicy -Scope CurrentUser Unrestricted" >> "%TEMP%\StartupLog.txt" 2>&1
PowerShell -File "%SystemDrive%\Scripts\MapDrives.ps1" >> "%TEMP%\StartupLog.txt" 2>&1
4) Create a script file named MapDrives.ps1 and insert the following.
$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 "There was an error mapping $MappedDrive.RemotePath to $MappedDrive.LocalPath"
}
}
$i = $i - 1
if($error.Count -eq 0 -Or $i -eq 0) {break}
Start-Sleep -Seconds 30
}
5) Copy the MapDrives.cmd file to %ProgramData%\Microsoft\Windows\Start Menu\Programs\StartUp
6) Copy the MapDrives.ps1 file to C:\Scripts\
Restart the computer and the issue should be fixed.
https://www.windowscentral.com/how-fix-mapped-network-drive-problem-windows-10-october-2018-update