Jump to content
TorGuard
  • 1

How to connect / disconnect via script?

Rate this question


Andy
 Share

Question

How can I connect to a specific city (say, Seattle) via command-line or script?  The Windows client is great, but I'd like to be able to fire up torguard and connect to (or disconnect from) the vpn via script.

 

Using Windows 7.  Batch script, powershell, even perl or other languages would be fine.  I don't need full working code - but was surprised not to find examples via my searches.

 

I have the "Anonymous VPN" service, if that matters - I see openvpn.exe, ss-local.exe, TorGuardDesktopQt.exe and TorGuardWindowsUtilities.exe in my installation directory.

 

Many thanks for any help!

 

Link to comment
Share on other sites

15 answers to this question

Recommended Posts

  • 1
38 minutes ago, Oro said:

2021. Is this at all in the pipeline for the near future? 

to be honest, it is quicker if you simply look it up. Install latest TorGuard client, enable debugging, connect with desired protocol/settings, discoonnect, then close TorGuard client. If you open your debug file, you will see how exactly TorGuard client connects and disconnects, then simply do the same.

When you install torguard client, then you can have also all domains which are used for connection, example for wireguard: https://github.com/TorGuard/openwrt-scripts/blob/master/etc/torguard/wireguard.json

If it helps, for wireguard there is enough info,  openconnect/anyconnect is kinda self explainable and openvpn is something I can not comment on as it is obsolete for me since years.

 

Link to comment
Share on other sites

  • 0

Hey guys - we have a command line interface coming in around 2 releases from now.

 

Hi - Any update on the command line interface, for Windows users especially?  Thanks --Andy

Link to comment
Share on other sites

  • 0

Hi - Any update on the command line interface, for Windows users especially?  Thanks --Andy

 

Andy, im sorry for the delay on this, we had quite a few other things we wanted to finnish first - i moved it to the release after next so expect it in 0.3.71

 

Regards

Link to comment
Share on other sites

  • 0

Andy, im sorry for the delay on this, we had quite a few other things we wanted to finnish first - i moved it to the release after next so expect it in 0.3.71

 

Hi - I'm following up on the command-line support.  I installed 0.3.71, and read through the release notes at https://torguard.net/forums/index.php?/topic/1214-torguard-client-v0371/

but don't see anything about command-line.  Is this still on the roadmap?

 

Thanks --Andy

Link to comment
Share on other sites

  • 0

REALLY need this implemented

 

need command line options for connect/disconnect,protocol server ect  

 

if this isn't implemented by the time my bill cycle is up i am changing providers 

 

its a must have for management scripts not everybody wants there vpns to run all the time

Link to comment
Share on other sites

  • 0

HI Support Staff - Following up on this, one last time.  What's going on with command-line support, on Windows (Win10, at this point)?  Will it be added as a feature? 

I'm hoping for a definitive answer.

Thanks --Andy

Link to comment
Share on other sites

  • 0

2021. Is this at all in the pipeline for the near future? 

 

Edit: I found a bit of a ghetto solution.

(Specifically for using Jdownloader's Reconnect with Torguard.)
Set TorGuard to automatically connect to a server at launch.
Then use this as the External batch script in Jdownloader:
 

taskkill /IM "TorGuardDesktopQt.exe" /F
sleep 5
"C:\Program Files (x86)\VPNetwork LLC\TorGuard\TorGuardDesktopQt.exe" (Or wherever else your install might be.)


This will kill the TorGuard client, wait 5 seconds, then re-open the client, which will automatically connect you to a new IP so long as you have none pinned.
Note that the Torguard software doesn't normally like you closing it while connected to a server. (Won't let you do it without ending the task.) In my experience, this closes the application window/system tray icon while keeping you connected to your VPN. Upon relaunching the app, it will connect you to a new server, replacing the one you were connected to. Once you disconnect using the app, you will be back to your VPNless internet. 
Since Torguard normally doesn't like you closing the application without disconnecting from a VPN, to be more safe than sorry I'll just say: do this at your own risk. It's worked fine for me so far.

Link to comment
Share on other sites

  • 0

I'd really like Torguard to be able to connect to random servers each time it starts... Your solution works Oro, but only for the same server... 🤔

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...