Page 1 of 1

Windows BAT File to Auto Mount Drive

Posted: Sun Aug 30, 2015 1:35 am
by Phantasmagoria
I am using the windows openvpn GUI client to autorun a bat file to mount a network drive upon a successful connection. However, the BAT file does not actually mount the drive after executing via the open vpn gu,i but it will successfully mount it if run via windows explorer. What do I need to change to allow this to happen properly? I am running windows 8.1 if that helps!

The name is matching my config file with an _up suffix. Here is the contents of the bat file:

net use Y: \\IP\groupwork password /user:username /persistent:no

I attempted to run it in the client config using the following command string, with the corresponding BAT file:

script-security 2
route-up route-up.bat

This appeared to do nothing, so I reverted back to the previous method. Is it a permission issue that could be causing this? I am open to whatever solution, I am not sold on any particular method! Thanks for any help.

Re: Windows BAT File to Auto Mount Drive

Posted: Sun Aug 30, 2015 10:20 pm
by Traffic
OpenVPN does not allow this kind of function ..

All called scripts must complete before the VPN is made available.

Re: Windows BAT File to Auto Mount Drive

Posted: Mon Aug 31, 2015 6:59 am
by MatVPN
For me it's working in the way you wish:
- you don't have to put this line "route-up route-up.bat" in your config - only the bat-file is needed
- you have to name it "route_up.bat" not "route-up.bat" (if yout config is named "route.ovpn")
Mathias

Re: Windows BAT File to Auto Mount Drive

Posted: Tue Sep 01, 2015 3:16 pm
by Traffic
It may work if you set /persistent:yes ..