CND script OpenVpn

This forum is for admins who are looking to build or expand their OpenVPN setup.

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

Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
Post Reply
Henry
OpenVpn Newbie
Posts: 4
Joined: Wed Feb 02, 2011 12:22 pm

CND script OpenVpn

Post by Henry » Wed Feb 02, 2011 12:35 pm

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

User avatar
maikcat
Forum Team
Posts: 4200
Joined: Wed Jan 12, 2011 9:23 am
Location: Athens,Greece
Contact:

Re: CND script OpenVpn

Post by maikcat » Wed Feb 02, 2011 12:41 pm

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
Amiga 500 , Zx +2 owner
Long live Dino Dini (Kick off 2 Creator)

Inflammable means flammable? (Dr Nick Riviera,Simsons Season13)

"objects in mirror are losing"

Henry
OpenVpn Newbie
Posts: 4
Joined: Wed Feb 02, 2011 12:22 pm

Re: CND script OpenVpn

Post by Henry » Wed Feb 02, 2011 1:33 pm

Hi,

Connect with the message OK appears. see. Preview

The script is halted.

Net use command works independently.

Image

User avatar
maikcat
Forum Team
Posts: 4200
Joined: Wed Jan 12, 2011 9:23 am
Location: Athens,Greece
Contact:

Re: CND script OpenVpn

Post by maikcat » Wed Feb 02, 2011 1:50 pm

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
Amiga 500 , Zx +2 owner
Long live Dino Dini (Kick off 2 Creator)

Inflammable means flammable? (Dr Nick Riviera,Simsons Season13)

"objects in mirror are losing"

Henry
OpenVpn Newbie
Posts: 4
Joined: Wed Feb 02, 2011 12:22 pm

Re: CND script OpenVpn

Post by Henry » Wed Feb 02, 2011 3:04 pm

This I do not understand, could you explain in more detail.

User avatar
maikcat
Forum Team
Posts: 4200
Joined: Wed Jan 12, 2011 9:23 am
Location: Athens,Greece
Contact:

Re: CND script OpenVpn

Post by maikcat » Thu Feb 03, 2011 7:25 am

hi there,

simple

substitute this:

>openvpn-gui --connect client.ovpn

with this:

net start "openvpn service"

cheers,

michael.
Amiga 500 , Zx +2 owner
Long live Dino Dini (Kick off 2 Creator)

Inflammable means flammable? (Dr Nick Riviera,Simsons Season13)

"objects in mirror are losing"

Henry
OpenVpn Newbie
Posts: 4
Joined: Wed Feb 02, 2011 12:22 pm

Re: CND script OpenVpn

Post by Henry » Fri Feb 04, 2011 9:00 am

That goes without problem. Thank you

Post Reply