locked
Delay mapped drives until VPN is connected RRS feed

  • Question

  • Hi,

    I am using a Windows 7 Pro x64 PC which connects to a Server 2003 SBS machine at another location via VPN (Hamachi software). The issue is that the Win7 computer attempts to connect its mapped network drives to the server before the Hamachi connection has been established, and therefore I get the message 'could not reconnect all network drives' when I log in. If I go into Explorer I can resolve this by simply clicking on the drives to access them, but it is a bit of a pain, especially when I forget and open up Sage or Act whose data is stored in the mapped location, then I have to shut them down, open up the drives and reopen the programs. So I would like to know if anyone has a resolution, perhaps by delaying the PC connecting to the mapped drives.

    I have done some pretty extensive Googling and checked through these forums and have only come across one solution, which I had already tried, to use a batch file with a delay instruction written in to connect the drives. However, I was not able to make this work as for some reason command prompt is unable to find the network location, returning error 67 the network name cannot be found when I use the net use command. If as an alternative someone is able to help me fix this problem, I would be happy with this solution. I am 100% sure that my syntax in the batch file is correct, it is a very simple command. This is what I have written:

    @echo off
    set delay=30
    ping localhost -n %delay%
    net use M:"\\server name\shared folder" /persistent:yes

    If I open up a command prompt and manually enter net use M:"\\server name\shared folder" I also get error 67. I am running cmd as administrator. I have tried using the IP address, internal and external (although this is not static), I have tried using the FQDN, I have tried with and without a username and password. If I open up Explorer I can easily access the shared folders over the network, I can map the drives manually through Explorer no problem, and if I go to Start and type \\server name into the Run box it opens up fine, so I can't understand why it can't be found by cmd.

    An answer to either of these problems would be much appreciated.


    Friday, October 18, 2013 3:50 PM

Answers