Delay mounting network drive at boot?

Anonymous
2010-04-17T12:13:51+00:00

I have a network drive that I have mapped as a drive on my toshiba nb205 notebook.  It works fine with one exception, boot-up time. 

When the notebook is booted it can never connect to the mapped drive, if I manually open the drive it will then connect and be fine.

My theory is that windows is trying to connect to the drive before the network connection is established. 

Is there a way to delay mounting the network attached drive until the network establishment is complete?

Windows for home | Previous Windows versions | Internet and connectivity

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
Answer accepted by question author
Anonymous
2010-04-17T13:17:11+00:00

Try this:

  1. Click Start, then type the three letters cmd into the Search box and press Enter.
  2. Type these commands and press Enter after each:

    net use /persistent:no

    net use * /del /yes

    notepad "%UserProfile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\netlogon.bat

  1. Type the following lines:

    @echo off

    set delay=60

    ping localhost -n %delay%

    net use E: "\SomePC\SomeShare"

  1. Save and close the file

From now on your network connection(s) will be made 60 seconds (or whatever delay you set) after you log on. You must, of course, replace "SomePC" and "SomeShare" with actual names. You also need to be careful with your typing. The commands I used will not tolerate many variations.

Was this answer helpful?

70+ people found this answer helpful.
0 comments No comments

45 additional answers

Sort by: Most helpful
  1. Anonymous
    2017-10-04T16:41:01+00:00

    Dear pravyroxr,

    Sorry for not noticing your kindly helping with a VBS script.  TBH I'm not familiar with running those outside of Word or Excel though I imagine I could quickly work it out using Visual Community 2017.  As you'll see I managed to resolve the problem by enhancing my Windows Batch file with a very nice technique for getting the output of a particular line of ping.exe into Batch variables.

    Thanks and big love & respect,

    Psy <3

    Faith : Hope : Unity

    United World Awakening WWW.UWA.Org

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2017-10-03T21:46:55+00:00

    "replace "SomePC" and "SomeShare" with actual names"

    It would be nice if you shared some examples of what you meant by "SomePC" and "SomeShare", such as the name of the one computer and the name of the other computer sharing with it.  

    By your explanation, my confidence level is high that most users need those examples, for without them, they can no longer proceed with your instructions.  Too many people take for granted most things when writing instructions.  I'm sorry if that sounds rude, because it's not meant to be, but that doesn't change the fact.

    "net use E:"  Is the command typed as shown or is the E: replaced with one's own particular required drive, and if so, WHAT drive and WHY?

    Also, what kind of file extension does this copy have?  Is it a batch file or what?

    Where is this file placed?  Root directory or where?

    I'm sorry, and I do appreciate you're attempts at trying to help, but this is exactly the way MS techs and most others write.  With BOLD assumptions on the part of the readers.

    The way to write is as if speaking to a person who has never before seen or heard of a computer.

    I say that tongue in cheek only to emphasize and don't literally mean it because I understand the length of the replies would be book thick.  But by feel and gauging of the questions presented, one can get a 'awareness' at the very least, on how much or little to respond with. 

    I consider myself fairly knowledgeable with tech, but even this has me stumped. 

    I have a wireless unit networked in my home office that keeps dropping shared files AS WELL AS noticing connections and drives appearing and suddenly disappearing, which may or may not have to do with the shared folders dropping out, and have been feverishly seeking an answer because it has me close to baying at the moon, so to get ambiguous and incomplete instructions pushes me closer to baying.

    Again, I am not thrashing you and to those who will mock me with my fairly knowledgeable statement, I did not say expert or high level.  I just mean more so than the 'average' computer user.  I am generalizing here because no-one can prove 'average' in this case, but either way, cut me some slack here.  I'm aggravated with this thing and have been with MS since the mid '80's for similar fashions and have been 'preaching' (for lack of a better word at the moment) this for decades now, and STILL nothing has EVER changed.  Not even remotely.

    And to those who would tell me to 'settle down', get off my pulpit or quit the 'tirade', then so be it.  I can handle that.  But at least I'm getting my frustrations out and THAT alone is therapeutic for me.

    fox

    Was this answer helpful?

    0 comments No comments
  3. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  4. Anonymous
    2017-09-12T16:04:48+00:00

    Due to a router error as well as the need to wait for my NetGear ReadyNas drives to start up I've created a batch file which both checks that the IP address is local and which loops on the Net Use commands.  Both features have been tested and they work.  I was particularly pleased to learn how to pipe output fdrom a .exe (in this case ping.exe), search it for a string and parse the found string without redirecting the output to a file :)

    My new NetMap.Bat is appended :)

      Thanks, love & respect,

    Psy <3

    Faith : Hope : Unity

    United World Awakening WWW.UWA.Org

    NEW NETMAP.BAT

    @ECHO OFF

    :: WAIT FOR THE NETWORK TO START THEN MAP NAS DRIVES  Ping works even if drives are sleeping...

    :: During testing I found that the Ping command may work even if the device is not connected to

    :: the LAN! Ping displays the device name prefixed "lan." & weirdly may show a competely different IP

    :: address from than that displayed by the NAS e.g. 92.242.132.16 instead of 192.168.1.7

    :: IT TURNED OUT THAT THE HUAWEI HG635 DOESN'T ALWAYS SEE ETHERNET DEVICE BY NAME! A Sr TalkTalk sales

    :: guy arranged for the latest super router to be sent to me - a D-Link! - sadly it proved not to have

    :: 1Gb Ethernet ports so I reverted to the one I bought on eBay & had to make this bullet proof:

    SET ReadyNas=UwaNas1

    :: New approach: checking for 192.xxx is better than checking ERRORLEVEL after pinging the NAS:

    :: Note if not 192.xxx then ping raises ERRORLEVEL > 0 but the cause can't be determined without

    :: searching/parsing the output file.  SETLOCAL is crucual 'cos of the weird way batch file are run:

    SETLOCAL

    FOR /F "tokens=4* delims=. " %%a in ('Ping %ReadyNas% -n 1 ^| find "Ping statistics for"') DO (

      SET FirstIp=%%a

      SET RestOfIp=%%b

    )

    IF NOT %FirstIp% == 192 (

      ECHO Router error: Ping returned a non-local IP address %FirstIp%.%RestOfIp% for %ReadyNas%!

      ECHO I'm afraid you're going to have to reboot because of a firmware bug in the Huawei635!!

      GOTO :Exit

    )

    ECHO Ping OK %ReadyNas% is at IP address %FirstIp%.%RestOfIp% now mapping network drives...

    ECHO Net Use * /Del /Yes >NUL

    Net Use * /Del /Yes >NUL

    IF ERRORLEVEL 1 GOTO :Error

    :: /a => arithmetical variable (default is string)

    SET /a WaitCount = 0

    SET /a WaitTime = 5

    SET /a WaitLimit = 8

    GOTO :NetUse

    :: IF Net Use didn't work then we have to wait for the NAS disks to wake up

    :Wait

    IF %WaitCount% GTR %WaitLimit% GOTO :Error

    SET /a WaitCount += 1

    :: The ECHO was for a SLEEP command which isn't available by default under W10

    :: (and maybe other versions as well: plainly batch file commands have moved on a

    :: lot since my DOS days when there wasn't even "IF c<condition> (<set of commands>)")!

    :: Next command is needed as TIMEOUT displays a countdown but ends in saying it's 'Waiting 0 seconds'!

    ECHO Waiting %WaitTime% seconds

    TIMEOUT %WaitTime% >NUL

    :: Now try to map Z: & U: drives (this can take a while IF disks have spun down)

    :: ECHO Y | Net Use * /Del doesn't work 'cos Net.Exe doesn't process pipe (hence the YES opt)!

    :NetUse

    ECHO Net Use Z: "\%ReadyNas%\PsyData"

    Net Use Z: "\%ReadyNas%\PsyData"

    IF ERRORLEVEL 1 GOTO :Wait

    ECHO Net Use U: "\%ReadyNas%\Utils"

    Net Use U: "\%ReadyNas%\Utils"

    IF NOT ERRORLEVEL 1 GOTO :Exit

    GOTO :Wait

    :Error

    ECHO Last command ERRORLEVEL is %ERRORLEVEL%

    :Exit

    PAUSE

    EXIT

    Was this answer helpful?

    0 comments No comments