SparkLabs Forum.

Community Help.

Reconnect script issue


I got a issue with my reconnect script i try since few days to fix it but not possible for me as i am not a programmer. There are my scripts:

Disconnect script (Work well):

netsh interface set interface "Wi-Fi" admin=DISABLED
netsh interface set interface "VMware Network Adapter VMnet1" admin=DISABLED
netsh interface set interface "VMware Network Adapter VMnet8" admin=DISABLED
taskkill /f /im firefox.exe
taskkill /f /im tor.exe
taskkill /f /im deluge.exe
taskkill /f /im deluged.exe
taskkill /f /im TeamViewer.exe
taskkill /f /im tv_w32.exe
taskkill /f /im tv_x64.exe
taskkill /f /im Terminals.exe

Reconnect script:

netsh interface set interface "Wi-Fi" admin=ENABLE
netsh interface set interface "VMware Network Adapter VMnet1" admin=ENABLE
netsh interface set interface "VMware Network Adapter VMnet8" admin=ENABLE
ping -n 4 -w 20000

When i run it viscosity disconnect and kill my wifi again.
I also tried to add "echo ViscosityNoConnect" but no success obviously viscosity won't connect when my wifi is activated.


Where is your reconnect script being run, just as a Before Connect script? Could you please post a copy of your log when this script is run as it should work, a 20 second delay should be ample time for your wifi to reconnect - ... envpn-log/

Thanks alot for your help. Yes the script is set as "Before connect" When running the script it looks like the Wifi interface is started but visco did not wait to connect to the wifi network and it kill my wifi interface again.

Windows 10 logs:

Code: Select all

Nov 14 6:10:12 PM: State changed to Connecting
Nov 14 6:10:12 PM: Viscosity Windows 1.6.6 (1461)
Nov 14 6:10:12 PM: Running on Microsoft Windows 10 Home Single Language
Nov 14 6:10:15 PM: Bringing up interface...
Nov 14 6:10:15 PM: Checking reachability status of connection...
Nov 14 6:10:15 PM: Reachability check failed for - Failed DNS Resolution
Nov 14 6:10:15 PM: Socket Error - No such host is known
Nov 14 6:10:15 PM: Connection is not reachable. Disconnecting.
Nov 14 6:10:15 PM: State changed to Disconnected

Windows 7 Logs:

Code: Select all

nov. 14 18:12:21: State changed to Connecting
nov. 14 18:12:21: Viscosity Windows 1.6.6 (1461)
nov. 14 18:12:21: Running on Microsoft Windows 7 Pro
nov. 14 18:12:27: Reachability check failed for - Failed DNS Resolution
nov. 14 18:12:27: Socket Error - Unknown Host
nov. 14 18:12:27: State changed to Disconnecting
nov. 14 18:12:29: Bringing up interface...
nov. 14 18:12:30: Checking the accessibility status of the connection ...
nov. 14 18:12:30: Reachability check failed for - Failed DNS Resolution
nov. 14 18:12:30: Socket Error - Unknown Host
nov. 14 18:12:30: The connection is not accessible. Disconnection in progress.
nov. 14 18:12:30: State changed to Disconnected

What happens if you do an nslookup on those addresses when Viscosity is failing? You may need to add an ipconfig -flushdns and maybe even restart the dnscache (net.exe stop dnscache && net.exe start dnscache).

Alternatively, if the IP addresses those addresses resolve to do not change, you may wish to change your connection so it uses an IP address to connect instead.

"net.exe stop dnscache && net.exe start dnscache" Did not change nothing.
And if i use "ipconfig -flushdns" I can't connect anymore even with without ON / OFF scripts

Connection is reachable. Starting connection attempt.
Options error: Unrecognized option or missing parameter(s) in C:\Program Files\Common Files\Viscosity\OpenVPNConfig\Home\57\config.conf:37: ipconfig (2.3.12)
Use --help for more information.
OpenVPN has exited.

The problem was that command "ping -n 4 -w 30000" Did not wait the delay and visco tried to connect directly.

I finally found how to fix it i added "powershell -command "Start-Sleep -s 8" in my before connect script and now everything is fine.

Glad you found a solution. The ipconfig would need to be added to your script, not the config itself. Windows DNS can take a bit to start functioning after a network adapter is enabled unfortunately, another thing to try would be trying to ping an FQDN rather than an IP.

6 posts Page 1 of 1

Copyright © 2016 SparkLabs Pty Ltd. All Rights Reserved. Privacy Policy