Unfortunately it doesn't help

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech
Thanks a lot...Bulvot wrote: Anyway, my final solution was to create a batch file (let's call it test.cmd):
@echo off
start c:\windows\system32\control.exe ncpa.cpl
Then add the following lines to the client configuration file:
script-security 2
up c:\\some\\directory\\test.cmd
The down side, of course, is that pops up the applet on your desktop. The upside is that the connection now works.
Code: Select all
@echo off
mode con: cols=53 lines=11
set vpnfail=0
set vpnrestartcount=0
set sbadip=169.254
rem IMPORTANT!!!
rem You MUST set the below parameters correctly or this script will not function properly.
rem To determine the correct interface number, run "netsh interface ipv4 show interfaces" and use the number in the "idx" column
rem that correspondes to the vpn adapter. It is usually labeled "Local Area Connection". You can change the name by renaming
rem the adapter here: Control Panel\Network and Internet\Network Connections
set ifnum=24
rem Fill in any IP address, hostname, or FQDN that is accessible through the VPN connection.
rem This will be used to test the VPN connection to see if pings are working. The host you specify
rem must respond to pings.
set paddress=ingo
rem This is the network address for the vpn-accessible network
set homegate=10.1.1.0
rem This is the subnet to look for to indicate which network is currently connected (should always be a class A, B or C address here)
set homenet=10.1.1
rem This is the VPN subnet to look for to indicate that the vpn routes are up
set vpnnet=10.1.2
rem This is the number of times you are willing to let the check fail before restarting the VPN service
rem Keep in mind that it sometimes takes several seconds for the vpn to come fully up even if it reports "connected".
rem Don't set this number too low. 4 is a reasonable number.
set vfailcnt=4
rem This is the number of seconds to wait between checks.
set vchckslp=3
rem This is the TCP port that your OpenVPN Service is listening on
rem This must be added to your openvpn opvn configuration file:
rem management 127.0.0.1 8645
set ovport=8645
rem Additionally, these settings on your opvn configuration file might be useful:
rem resolv-retry infinite
rem connect-retry 5
rem keepalive 10 60
rem tun-mtu 1500
rem tun-mtu-extra 32
:start
set vpnip=
set vpnstatus=
set vpnroutes=
set openstate=
set vpnping=
set vpnservice=
call :getip
call :getroutes
call :getping
call :openstatus
call :getstatus
cls
echo VPN Status: %vpnstatus%
echo OpenVPN State: %openstate%
echo Current VPN Adapter IP: %vpnip%
echo VPN Routes: %vpnroutes%
echo Last Ping Response Time: %vpnping%
echo Failure Count: %vpnfail%
echo Restart Count: %vpnrestartcount%
if "%vpnfail%" geq "%vfailcnt%" call :vpnrestart
timeout /t %vchckslp% /nobreak >nul
goto start
:getip
for /f "tokens=2" %%i in ('netsh interface ipv4 show ipaddresses 24 ^| find ^"Parameters^" ') do @set vpnip=%%i
for /f "tokens=4" %%i in ('netsh interface ipv4 show ipaddresses 24 ^| find ^"DAD State^" ') do @set vpnipstate=%%i
if "%vpnipstate%" == "Deprecated" set vpnip=Unassigned
set vpnipstate=
goto :EOF
:getroutes
if "%vpnip%" == "Unassigned" set vpnroutes=No VPN Connection& goto :EOF
for /f "tokens=4" %%i in ('route print ^| find ^"%homegate%^"') do @set vpngate=%%i
for /f %%i in ('echo %vpngate% ^| find ^"%homenet%^"') do @set vpnroutes=Connected to Home Network
for /f %%i in ('echo %vpngate% ^| find ^"%vpnnet%^"') do @set vpnroutes=Good VPN Routes
if defined vpnroutes goto :EOF
set vpnroutes=Bad VPN Routes
set vpngate=
goto :EOF
:getping
if "%vpnroutes%" == "Bad VPN Routes" set vpnping=No Valid Route Available& goto :EOF
if "%vpnroutes%" == "No VPN Connection" set vpnping=No Valid Route Available& goto :EOF
for /f "tokens=3 delims==" %%i in ('ping -w 3000 -n 1 %paddress% ^| find ^"Reply^"') do @set vpnping=%%i
if defined vpnping set vpnping=%vpnping: TTL=%& goto :EOF
set vpnping=No Response
goto :EOF
:openstatus
echo state>%0\..\openvpnstate.scr
echo exit>>%0\..\openvpnstate.scr
for /f "tokens=2 delims=," %%i in ('type %0\..\openvpnstate.scr ^|nc 127.0.0.1 %ovport%') do set openstate=%%i& goto :EOF
for /f "tokens=2 delims=," %%i in ('type %0\..\openvpnstate.scr ^|nc -i 1 127.0.0.1 %ovport%') do set openstate=%%i
del /q %0\..\openstate.scr >nul 2>nul
goto :EOF
:getstatus
for /f %%i in ('net start ^| find ^"OpenVPN^"') do @set vpnservice=%%i
if not defined vpnservice set vpnstatus=Service Stopped&set vpnfail=999& goto :EOF
if "%openstate%" neq "CONNECTED" set vpnstatus=Disconnected& set vpnfail=0& goto :EOF
for /f %%i in ('echo %vpnip% ^| find ^"%sbadip%^"') do @set vpnstatus=Bad IP& set /a vpnfail=%vpnfail% + 1& goto :EOF
for /f "tokens=3" %%i in ('netsh interface ipv4 show interfaces %ifnum% ^| find ^"State^"') do @if "%%i" == "disconnected" set vpnstatus=Disconnected& set vpnfail=0& goto nextstat
if "%vpnroutes%" == "Bad VPN Routes" set vpnstatus=Good IP but Bad Routes& set /a vpnfail=%vpnfail% +1& goto :EOF
if "%vpnping%" == "No Response" set vpnstatus=Bad or Slow Connection& set /a vpnfail=%vpnfail% + 1& goto :EOF
set vpnstatus=Good Connection
set vpnfail=0
goto :EOF
:nextstat
if "%openstate%" neq "CONNECTED" goto :EOF
set vpnstatus=Connected with Bad Network Configuration
set /a vpnfail=4
start %windir%\system32\control.exe %windir%\ncpa.cpl
goto :EOF
:vpnrestart
if "%vpnstatus%" == "Service Stopped" goto restart
if "%openstate%" neq "CONNECTED" goto :EOF
:restart
echo.
echo.
echo Restarting VPN Service...
set vpnfail=0
ipconfig /flushdns>nul 2>nul
set /a vpnrestartcount=%vpnrestartcount% + 1
net stop "openvpn service" >nul 2>nul
timeout /t 2 /nobreak >nul
net start "openvpn service" >nul 2>nul
goto :EOF
Code: Select all
netsh interface set interface "Local Area Connection" ENABLED
Code: Select all
net stop OpenVPNService
start c:\windows\system32\control.exe ncpa.cpl
net start OpenVPNService
Faulting application name: openvpn-gui.exe, version: 2.0.0.0, time stamp: 0x511d035b
Faulting module name: msvcrt.dll, version: 7.0.9200.16384, time stamp: 0x5010ac20
Exception code: 0xc0000005
Fault offset: 0x0000000000001264
Faulting process id: 0xa58
Faulting application start time: 0x01ce18b23178df37
Faulting application path: C:\Program Files\OpenVPN\bin\openvpn-gui.exe
Faulting module path: C:\Windows\system32\msvcrt.dll
Report Id: 51d08b26-8566-11e2-bef4-74f06debe923
Faulting package full name:
Faulting package-relative application ID:
Thanks! This works here, too.Clodo wrote: Actually, in my test environment,
i don't have installed the "RAS Connection Manager Administration Kit (CMAK)",
i don't have started or set auto the service "Netman",
i simply runWhen i detect in the log the message "Waiting for TUN/TAP interface to come up".Code: Select all
netsh interface set interface "Local Area Connection" ENABLED
("Local Area Connection" is my TAP-Windows interface).
Code: Select all
C:\Windows\System32\netsh interface set interface %1 Enabled
Code: Select all
script-security 2
up enabletap.cmd
I updated OpenVPN on a Win 8 PC few months ago and the problem existed after the update. I have not updated to Win 8.1 yet.rseiler wrote:It's long solved.