Open unalignedcoder opened 2 years ago
You can very easily use expresso
in a PowerShell Script. I have created a PowerShell script which attempts a reconnection to ExpressVPN every single time Windows fires a Network Disconnected
event.
Check-VPNConnection.ps1:
$output = & expresso.exe status
Write-host $output
if ($output -ieq "VPN not connected") { expresso connect 'UK - Wembley' }
I then configure a Windows Task as follows:
Arguments: -NonInteractive -File "C:\Tools\scripts\check-vpnconnection.ps1"
Expresso
status
works very well, but cannot really be used in a script.Rather than returning a full sentence, it would be great if it could return a simple boolean value of
0
or1
.Suppose the user needs first of all to find out whether the VPN is connected.
In a simple batch script in cmd language, it is a pain to break apart the sentences "VPN connected to server" or "VPN not connected", to figure out their actual value.
I understand the full sentence actually comes from ExpressVPN, not by Expresso.
Still, is there any way to get
status
to return a machine-readable value?