Discussion:
[Openvpn-users] delay of script on Windows client
m***@centrum.cz
2009-01-14 09:06:45 UTC
Permalink
Hi, i didnt found my question in man page..

Please how to solve following:
windows client, establishing connection - I want execute "up.script", but it starts during VPN opening session - yellow state - after some time, I have error "Script timeout"

I tried to fix it with "--up-delay X" command, but no success, maybe wrong syntax

please tell me how do following:

Openvpn goes UP (green state) after that, cmd-bat script execute (mapping some shares, make some report from client)

Thank You

P.
John
2009-01-15 10:14:15 UTC
Permalink
Post by m***@centrum.cz
Hi, i didnt found my question in man page..
windows client, establishing connection - I want execute "up.script", but
it starts during VPN opening session - yellow state - after some time, I
have error "Script timeout"
I tried to fix it with "--up-delay X" command, but no success, maybe wrong syntax
Openvpn goes UP (green state) after that, cmd-bat script execute (mapping
some shares, make some report from client)
Thank You
Hi,
We encountered the same problem, and I found a (2step) work around for it.
You need the sleep.exe command included with the Windows Resource Kit Tools

the up-script will be executed synchronous, so adding sleep.exe here won't
work. the VPN opening session sleeps to then :-(
So the trick is to spawn a new cmd shell witch is independent of it's
spawning parent (openvpn.exe) Add the sleep.exe and the commands you want to
execute when VPN initialisation is ready there

So:
Openvpn.conf.
..
...
script-security 2 system # When using new 2.1 rc
up-script up "C:\\somepath\\spawn.bat"


spawn.bat
start C:\\somepath\\rdp.bat

rdp.bat
@echo off
@echo waiting VPN initialisation to complete
@echo Starting remote Desktop after 8 seconds
sleep 8
start mstsc "C:\\somepath\\WTS.rdp"
exit


Success,
John
dev
2009-01-17 02:41:34 UTC
Permalink
...
Post by John
Hi,
We encountered the same problem, and I found a (2step) work around for it.
You need the sleep.exe command included with the Windows Resource Kit Tools
...
Minor comment: don't forget the age-old trick for adding a delay in a batch file: pinging 127.0.0.1 for a specific count of pings. This will avoid the need to download and install an additional executable.
-Dave

Loading...