I'm having a problem with my VPN connection at work, interfering with some Internet Connectivity during start up.

I have set up the VPN to not "Use default gateway on remote network" so, once I connect to the VPN, my Internet traffic goes through the normal route and everything works like a charm, including mapped network drives and so on.

The problem I have is at start up (basically when I come in in the morning), what happens here is that there is a Log On script that maps my Documents folder to a network drive (H: as usual). If I left the VPN from the day before, the mapping is broken and I cannot browse to the H drive. The solution is generally to disconnect the VPN, browse to the H drive (which will work ok now) and then reconnect the VPN (at this point the H drive will keep on working fine).

Does anyone have any idea what may cause this and how to overcome the problem? I'm sorry I don't have access to the Log On script but I'm assuming is a pretty standard thing (I've seen it in other workplaces).

I'm an admin on the machine and I was thinking that a solution could be to add a script that disconnect the VPN (using rasdial) before Log On. Do you think it's a good idea or is there something else I should consider?

  • Since you're an admin on the machine, it wouldn't hurt to check "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Startup" to see if the login script runs from there. It's common to see scripts there to map drives superuser.com/questions/557472/… – root Aug 20 '14 at 11:34
  • Hi @root. Nope, the script is \\%logonserver%\netlogon\userscript.bat but when I browse the netlogon folder it's empty... – Tallmaris Aug 20 '14 at 13:45

You could use the following, which will automate the process you posted as a work-around:

@echo off
rem disconnect from VPN
rasdial vpnserver /disconnect

rem explore to the H drive
cd H:
explorer .

rem reconnect to VPN
rasdial vpnserver stationname password

You may also consider removing the map to H and recreating it, possibly after disconnecting from the VPN and before exploring to H:

rem remove map to H
net use H: /del /y

rem restore map to H
net use H: "\\network\path"
  • Is there a way to run this before LogOn? In the Task Scheduler it's not very clear what is executed before what... – Tallmaris Aug 20 '14 at 16:01
  • I'll see what happens tomorrow morning... I'll skip the reconnect part since I don't like to have my password sitting in clear there... – Tallmaris Aug 20 '14 at 16:08
  • Others have used srvany to run scripts as a service superuser.com/questions/548192/… . Although in a work environment, it's always best to just speak with your admin – root Aug 20 '14 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.