2

Is there any possibility to get the status of the openvpn-gui, weather it is working or not?

I tried it with:

Process.GetProcessesByName("openvpn").Length

But this is always 0, if there is no connection. I can click the EXE, then I got a red symbol and an entry in taskmanager, which shows not connected, but the process status in C# remains at 0.

This is quite bad, because I can't kill this process and can't open a new one. In my program I want to call a website, which is password protected, for this I need OpenVPN with its configurations. But I cannot start OpenVPN, if it is running, although it is not connected. So I want to check the status of this program, weather it is running or not.

  1. How can I readout the status of the EXE?
  2. How can I reconnect with C#, if there is no connection?

I wrote a thread on openvpn forum (german) but they also do not know.

Windows netstat -r or ipconfig /all or /allcompartments doesn't help.

I'm working with Visual C# 2010 Express and OpenVPN_2.3.2.0 on Win8.

PS: ovpn-red.png:

This is the status, I want to readout with C#.

ArtKorchagin
  • 4,801
  • 13
  • 42
  • 58
MoaByter
  • 21
  • 2
  • 1
    Not sure what you want to do, but is `openvpn-gui.exe` kind of what you are trying to make? – Codecat Aug 11 '13 at 16:57
  • I have to open openvpn to get a website with password block. I cannot -reconnect programmably and cannot reopen openvpn, if it is runnung. – MoaByter Aug 11 '13 at 17:08
  • You're probably looking for the [management interface](http://openvpn.net/index.php/open-source/documentation/miscellaneous/79-management-interface.html), but I think only one process is allowed to communicate with the openvpn.exe process at a time, and it runs elevated which both may be issues for using it. – Anya Shenanigans Aug 11 '13 at 17:28
  • Not this way. Ovpn & the C#-programm are both running on my computer. I want to check the status of ovpn with my C#-program. Switch it on/off/restart/reconnect. Starting it, if it isn't running - no poroblem. Calling a website if it is connected - okay. But if this ovpn is running **without** connection I C# cannot see this, allthoug it is listed in taskmanager. I want to know in which way you all are dealing with this. – MoaByter Aug 11 '13 at 18:00
  • I'm only interessted in getting the status of the **openvpn-gui.exe**. How can I get this, if it is not **connected** but started? Or: I want C# to "see" the "color" of the symbol in the launchbar. :-)) – MoaByter Aug 11 '13 at 18:07
  • considering the program is called `openvpn-gui`, you should probably look for that name. You would only match `openvpn` if the connection was active – Anya Shenanigans Aug 11 '13 at 19:19

0 Answers0