Page 1 of 1

Set Connection Script via Command Line

Posted: Wed Jul 07, 2021 2:37 am
by dalbert
Hello, Sparklabs support,

I need to set up a connection script using a command line. Currently, I have to open Viscosity Preferences, go to Edit connection, click on the Advanced tab, click on the Select button next to Connected Script, navigate the script location, select the script and click on Open.
I need to automate these steps.

Thank you,
David Albert.

Re: Set Connection Script via Command Line

Posted: Wed Jul 07, 2021 9:15 am
by Eric
Hi David,

If you hold shift and right click the connection, then click View Configuration Data, you will be able to see the raw configuration commands (starting with #viscosity) that are added to the configuration. You can use this to match the command Viscosity is adding. You can add these manually at %appdata%\OpenVPN, and copy the script in.

The caveat is after you change the configuration, you will need to restart Viscosity for it to reload the changed configuration in.

Regards,
Eric

Re: Set Connection Script via Command Line

Posted: Wed Jul 07, 2021 11:59 pm
by dalbert
Hello Eric,

Thank you for the prompt response.
I have a problem following your instruction. When I press and hold Shift and right-click on the connection, I can see the "View Configuration Data," but it opens the blank untitled document when I click on it. However, if I go to the %appdata%\Viscosity\OpenVPN\2,3,4 - I can see config.conf file with the lines starting with #viscosity. I tried to edit this file manually and restart the Viscosity client and service. When I open the Viscosity preference, edit, advanced - I don't see the script name mentioned in the config.conf file: #viscosity connectedscript logon.vbs, but when I do it using GIU, it creates the same line in the config.conf file, and I can see the script name in the "Connected Script" field.
Also, I created two config.conf files using GUI, one with reference to the Connected Script and another without it. When I replaced one file with another, restart both the Viscosity client and service, I don't see logon.vbs in the "Connected Script" field when presented in the config.conf file.
Please advice.

Regards,
David Albert.

Re: Set Connection Script via Command Line

Posted: Fri Jul 09, 2021 11:14 am
by Eric
Hi dalbert,

Are you copying in the script beside the configuration as well, ensuring it has the same name?

Please ensure the modification is made with Viscosity.exe exited. You do not need to restart the service.

Regards,
Eric

Re: Set Connection Script via Command Line

Posted: Fri Jul 09, 2021 11:27 pm
by dalbert
Hello Eric,

Yes, I copy the script, and I confirm the script file name matches the record in the config.conf file.

Regards,
David.

Re: Set Connection Script via Command Line

Posted: Mon Jul 12, 2021 12:55 pm
by Eric
Hi David,

Could you please take a copy of the connection folder from %appdata%\Viscosity\OpenVPN, remove the certificates or other PKI, and send us a copy (should be just the config.conf and script) and we'll take a look to see if we can replicate what is going on. You're welcome to sensor any information like addresses if you wish.

https://sparklabs.com/support#contact

Regards,
Eric