Hi, have you tried the "NET USE" command? I've wrapped this into a batch file and put its shortcut in the Windows "Startup" folder (normally C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp). You can, of course, use other methods to run the batch file at start up. I've listed the code in my blog article at
http://www.metalvortex.com/blog/2016/07/24/1903.html but I've copied the code here too if you want to use it. The code is meant to be visible and interactive. You may wish to set the "loopvalue" to a higher number. I find that the command may need to loop about 7 times in the worst case. Please change the share location to suit your environment!
@ECHO OFF
TITLE Mapping network drives
@ECHO Please wait whilst we reconnect your network drives.
SETLOCAL ENABLEEXTENSIONS
SET me=%~n0
SET parent=%~dp0
SET neterror=0
SET counter=1
SET loopvalue=11
SET /A trueloop=%loopvalue%-1
:Start
ECHO _____________________________________
ECHO(
IF %counter% EQU %loopvalue% (
ECHO Connection to D:\ drive timed-out
SET neterror=1
GOTO End
)
ECHO Attempt %counter% of %trueloop% to D:\ drive
TIMEOUT /t 5 /NOBREAK >NUL
IF EXIST D:\NUL (
ECHO Attempt %counter% successful.
GOTO End
)
NET USE D: \\192.168.49.69\Data /PERSISTENT:YES
IF %ERRORLEVEL% NEQ 0 (
SET /A counter=%counter%+1
GOTO Start
)
:End
SET counter=1
SET loopvalue=8
SET /A trueloop=%loopvalue%-1
IF %neterror% EQU 0 GOTO Endofscript
:userconfirm
ECHO _____________________________________
ECHO(
SET /P userinput="Errors were found. Do you wish to try again [Y/n] "
IF /I "%userinput%" EQU "y" GOTO Start
IF /I "%userinput%" EQU "" GOTO Start
IF /I "%userinput%" EQU "n" GOTO Endofscript
GOTO userconfirm
:Endofscript
ECHO _____________________________________
ECHO(
@ECHO Please wait, script is closing.
TIMEOUT /t 5 /NOBREAK >NUL
ENDLOCAL
@ECHO OFF
@EXIT /B 0