Skip to content

Instantly share code, notes, and snippets.

@bvanskiver
Last active March 14, 2023 07:25
Show Gist options
  • Save bvanskiver/122af6ee9c7843c89225d954165f4264 to your computer and use it in GitHub Desktop.
Save bvanskiver/122af6ee9c7843c89225d954165f4264 to your computer and use it in GitHub Desktop.
Shrew Soft VPN client shortcut with saved credentials
rem http://www.shrew.net/
"C:\Program Files\ShrewSoft\VPN Client\ipsecc.exe" -r "VPN Profile Name" -u "Username" -p "Password" -a
Copy link

ghost commented Aug 2, 2019

привет, а в linux как вписывать учетные данные в конфигурационный файл ?

@bvanskiver
Copy link
Author

привет, а в linux как вписывать учетные данные в конфигурационный файл ?

Sorry, not sure - I only use this on Windows.

@tukusejssirs
Copy link

tukusejssirs commented Aug 23, 2019

@sdkbotik, on Linux, the command name is ikec, and the syntax is the same, but you need to specify -a option to automatically connect to server. Also, in v2.2.1 in GUI I haven’t found a way to change the profile name, there the name is the server/gateway IP address. The profiles are located in ~/.ike/sites (the profile file name is the profile name).

ikec -r "VPN Profile Name" -u "Username" -p "Password" -a

$ ikec
ii : ## : VPN Connect, ver 2.2.1
## : Copyright 2013 Shrew Soft Inc.
## : press the <h> key for help
!! : invalid parameters specified ...
>> : ikec -r "name" [ -u <user> ][ -p <pass> ][ -a ]
 -r	site configuration path
 -u	connection user name
 -p	connection user password
 -a	auto connect

Also note that this command is interactive (even when -a option is used), therefore when you run it, it will look like this:

ii : ## : VPN Connect, ver 2.2.1
## : Copyright 2013 Shrew Soft Inc.
## : press the <h> key for help
>> : config loaded for site 'VPN Profile Name'
>> : attached to key daemon ...
>> : peer configured
>> : iskamp proposal configured
>> : esp proposal configured
>> : client configured
>> : local id configured
>> : remote id configured
>> : pre-shared key configured
ii : bringing up tunnel ...
>> : network device configured
ii : tunnel enabled

… and it keeps open the connection until q key is pressed. You can press h key to show the following help:

 - : <c> connect
 - : <d> disconnect
 - : <h> help
 - : <s> status
 - : <q> quit

Copy link

ghost commented Aug 25, 2019

@tukusejssirs Thanks, bro!

@tukusejssirs
Copy link

tukusejssirs commented Aug 26, 2019

@sdkbotik, You’re welcome. ;)

@nitinjain1005
Copy link

"C:\Program Files\ShrewSoft\VPN Client\ipsecc.exe" -r "VPN Profile Name" -u "Username" -p "Password" -a

Adding -a for auto connect

@bvanskiver
Copy link
Author

bvanskiver commented Sep 25, 2019

"C:\Program Files\ShrewSoft\VPN Client\ipsecc.exe" -r "VPN Profile Name" -u "Username" -p "Password" -a

Adding -a for auto connect

@nitinjain1005 Thanks, I'll add that!

@jkyadav
Copy link

jkyadav commented Oct 10, 2019

@bvanskiver is there any way to auto close the command prompt? I tried EXIT but that didn't work.

@tukusejssirs
Copy link

tukusejssirs commented Oct 10, 2019

@jkyadav, when you leave the ikec/ipsecc command open, you can press (I think) x q (I am not sure if it is x or q, I always forget it. I have cheched upon it.)

Copy link

ghost commented Oct 10, 2019

#!/bin/bash
qikec -r VPN -u [email protected] -p password -a

(in Linux)

@Bluscream
Copy link

@bvanskiver is there any way to auto close the command prompt? I tried EXIT but that didn't work.

@jkyadav start "" "C:\Program Files\ShrewSoft\VPN Client\ipsecc.exe" -r "VPN Profile Name" -u "Username" -p "Password" -a

@jkyadav
Copy link

jkyadav commented Jul 30, 2020

@Bluscream thank you.

@Brinky-MLT
Copy link

Brinky-MLT commented Dec 6, 2020

Hi, I'm not a tech genius is there a way I could set such connection and say it will connect @06:00 daily for 1 hour?
Would also need guidance, are the scripts above to run in a bat file or an other?
Thanks in advance

Copy link

ghost commented Dec 6, 2020

Hi, I'm not a tech genius is there a way I could set such connection and say it will connect @06:00 daily for 1 hour?
Would also need guidance, are the scripts above to run in a bat file or an other?
Thanks in advance

Windows scheduler should help you with this.

@Brinky-MLT
Copy link

@sdkbotik thanks now I got it working

@joy6oy
Copy link

joy6oy commented Dec 6, 2020

@sdkbotik thanks now I got it working

Отлично! Я рад Вам помочь.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment