Page 1 of 1

CND script OpenVpn

Posted: Wed Feb 02, 2011 12:35 pm
by Henry
Hi,
I'm trying to write a script on the VPN connection and remapping drives.

Input script:

Code: Select all

echo connect...

openvpn-gui --connect client.ovpn

echo connect is OK!

net use * /delete /Y

net use i: \\10.0.0.8\Install /user:sss 1s1s11sss11 /Y

echo END!
Output from script:

Code: Select all

echo connect...

openvpn-gui --connect client.ovpn
VPN connects. Fails to remap drives, until im stop the vpn.

Why? Thank

Re: CND script OpenVpn

Posted: Wed Feb 02, 2011 12:41 pm
by maikcat
hi there,

one question..

is the message connect is ok displayed after the establishment of the tunnel?
or is the script continues whithout waiting for the tunnel to come up?

ps:does the net use command works if you give it manually after the vpn is up?

cheers,

michael

Re: CND script OpenVpn

Posted: Wed Feb 02, 2011 1:33 pm
by Henry
Hi,

Connect with the message OK appears. see. Preview

The script is halted.

Net use command works independently.

Image

Re: CND script OpenVpn

Posted: Wed Feb 02, 2011 1:50 pm
by maikcat
quick answer:

you can do the same thing if you use openvpn as a service,and a batch file to stop/start it...

--i know that when you use it as a service it starts *all* the configs at once.. :s

cheers,

michael

Re: CND script OpenVpn

Posted: Wed Feb 02, 2011 3:04 pm
by Henry
This I do not understand, could you explain in more detail.

Re: CND script OpenVpn

Posted: Thu Feb 03, 2011 7:25 am
by maikcat
hi there,

simple

substitute this:

>openvpn-gui --connect client.ovpn

with this:

net start "openvpn service"

cheers,

michael.

Re: CND script OpenVpn

Posted: Fri Feb 04, 2011 9:00 am
by Henry
That goes without problem. Thank you