Skip to content
Connect/Disconnect Scripts
Got a problem with Viscosity or need help? Ask here!
Hi there
I've written a (very) simple 2 line batch script to map a network share when I connect to a VPN.
@echo off
net use T: \\192.168.1.3\sharename /persistent:no
All works fine when I run the script manually. But when I add it as the connected script, the drive doesn't get added.
Any help greatly appreciated.
Thanks.
Mike
I've written a (very) simple 2 line batch script to map a network share when I connect to a VPN.
@echo off
net use T: \\192.168.1.3\sharename /persistent:no
All works fine when I run the script manually. But when I add it as the connected script, the drive doesn't get added.
Any help greatly appreciated.
Thanks.
Mike
Hi Mike,
Please ensure the script has been added by clearing it and adding it again to your configuration and saving. The script is copied so if you modified it after adding it, those changes have not been added.
Depending on your configuration, it can take a few seconds for Windows routes to become active, you may need to add a small delay to your batch script before calling net use.
Finally, ensure nothing is blocking the script from running like AV software.
Regards,
Eric
Please ensure the script has been added by clearing it and adding it again to your configuration and saving. The script is copied so if you modified it after adding it, those changes have not been added.
Depending on your configuration, it can take a few seconds for Windows routes to become active, you may need to add a small delay to your batch script before calling net use.
Finally, ensure nothing is blocking the script from running like AV software.
Regards,
Eric
Eric Thorpe
Viscosity Developer
Web: http://www.sparklabs.com
Support: http://www.sparklabs.com/support
Twitter: http://twitter.com/sparklabs
Viscosity Developer
Web: http://www.sparklabs.com
Support: http://www.sparklabs.com/support
Twitter: http://twitter.com/sparklabs
- Posts: 30
- Joined: Sat Feb 23, 2019 12:15 pm
hi,
having the similar problem.
script is not run after connect but runs from command line.
as you suggested, i tried this but did not help.
"clearing it and adding it again to your configuration and saving"
this is the script
note: amsg.exe display whatever text it is passed. i add this when testing.
i made sure to use full paths.
-------------------
C:\data\C\BitviseSSHClient\profiles\home\local\amsg.exe test
C:\data\C\BitviseSSHClient\stnlc.exe -noRegistry -profile=C:\data\C\BitviseSSHClient\profiles\home\local\opnsense.local.asdffdsa.tlp
-------------------------
thanks in advance
having the similar problem.
script is not run after connect but runs from command line.
as you suggested, i tried this but did not help.
"clearing it and adding it again to your configuration and saving"
this is the script
note: amsg.exe display whatever text it is passed. i add this when testing.
i made sure to use full paths.
-------------------
C:\data\C\BitviseSSHClient\profiles\home\local\amsg.exe test
C:\data\C\BitviseSSHClient\stnlc.exe -noRegistry -profile=C:\data\C\BitviseSSHClient\profiles\home\local\opnsense.local.asdffdsa.tlp
-------------------------
thanks in advance
Hi asdffdsa6131,
Please create a new script with the following contents and name it "connected.bat":
Regards,
Eric
Please create a new script with the following contents and name it "connected.bat":
Code: Select all
Set this as your connected script and connect, this should open our website in your default browser when connected. Please let us know if this works or not.@echo off
start "" https://www.sparklabs.com
Regards,
Eric
Eric Thorpe
Viscosity Developer
Web: http://www.sparklabs.com
Support: http://www.sparklabs.com/support
Twitter: http://twitter.com/sparklabs
Viscosity Developer
Web: http://www.sparklabs.com
Support: http://www.sparklabs.com/support
Twitter: http://twitter.com/sparklabs
- Posts: 30
- Joined: Sat Feb 23, 2019 12:15 pm
hi,
fyi, it is confusing to continue an existing post, as now, i cannot see the previous posts in this chain.
i followed your advice,
created a new .cmd file with that text.
using the gui, i cleared the existing script entry.
i pointed the gui to the new .cmd file.
i noticed that the gui copied the .cmd file to C:\Users\user01\AppData\Roaming\Viscosity\OpenVPN\2\stnlc-opnsense.local.asdffdsa.cmd
that script is not getting executed when the vpn connects.
if i run that script manually, it does open the website.
if i look inside C:\Users\user01\AppData\Roaming\Viscosity\OpenVPN\2\config.conf, i see
#viscosity connectedscript stnlc-opnsense.local.asdffdsa.cmd
thanks for the quick reply,
david
fyi, it is confusing to continue an existing post, as now, i cannot see the previous posts in this chain.
i followed your advice,
created a new .cmd file with that text.
using the gui, i cleared the existing script entry.
i pointed the gui to the new .cmd file.
i noticed that the gui copied the .cmd file to C:\Users\user01\AppData\Roaming\Viscosity\OpenVPN\2\stnlc-opnsense.local.asdffdsa.cmd
that script is not getting executed when the vpn connects.
if i run that script manually, it does open the website.
if i look inside C:\Users\user01\AppData\Roaming\Viscosity\OpenVPN\2\config.conf, i see
#viscosity connectedscript stnlc-opnsense.local.asdffdsa.cmd
thanks for the quick reply,
david
Hi,
The script needs to be a .bat file for Viscosity to execute it.
Regards,
Eric
The script needs to be a .bat file for Viscosity to execute it.
Regards,
Eric
Eric Thorpe
Viscosity Developer
Web: http://www.sparklabs.com
Support: http://www.sparklabs.com/support
Twitter: http://twitter.com/sparklabs
Viscosity Developer
Web: http://www.sparklabs.com
Support: http://www.sparklabs.com/support
Twitter: http://twitter.com/sparklabs
7 posts
Page 1 of 1