Windows BAT File to Auto Mount Drive

How to customize and extend your OpenVPN installation.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Post Reply
Phantasmagoria
OpenVpn Newbie
Posts: 1
Joined: Sun Aug 30, 2015 1:10 am

Windows BAT File to Auto Mount Drive

Post by Phantasmagoria » Sun Aug 30, 2015 1:35 am

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.

User avatar
Traffic
OpenVPN Protagonist
Posts: 4066
Joined: Sat Aug 09, 2014 11:24 am

Re: Windows BAT File to Auto Mount Drive

Post by Traffic » Sun Aug 30, 2015 10:20 pm

OpenVPN does not allow this kind of function ..

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

MatVPN
OpenVpn Newbie
Posts: 16
Joined: Tue Jul 23, 2013 1:16 pm

Re: Windows BAT File to Auto Mount Drive

Post by MatVPN » Mon Aug 31, 2015 6:59 am

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

User avatar
Traffic
OpenVPN Protagonist
Posts: 4066
Joined: Sat Aug 09, 2014 11:24 am

Re: Windows BAT File to Auto Mount Drive

Post by Traffic » Tue Sep 01, 2015 3:16 pm

It may work if you set /persistent:yes ..

Post Reply