How to detect if a OpenVPN connection is currently active or if it has dropped out
One option is to call ipconfig and look for the IP address assigned by the VPN server under the "Ethernet adapter Local Area Connection 2".
To ensure that IP traffic is actually routed across the VPN and hence encrypted check that the VPN assigned IP Address appears as the first hop when doing a tracert.
See also:
- Testing Your OpenVPN Encrypted Connection (Windows) - PDF
- Stack Overflow: How do I launch OpenVPN from within my C# windows application?
- Stack Overflow: C# - Close OpenVPN Cleanly
- Stack Overflow: How do I programmatically disconnect an OpenVPN connection?
- Stack Overflow: Problem disconnecting OpenVpn from application