Created
February 16, 2023 16:12
-
-
Save jnnsrctr/30ade5a62293d5c558470230ef3cf8e7 to your computer and use it in GitHub Desktop.
Method that checks if a VPN is connected
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static bool VpnCheck() | |
{ | |
if (NetworkInterface.GetIsNetworkAvailable()) | |
{ | |
NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces(); | |
foreach (NetworkInterface Interface in interfaces) | |
{ | |
if (Interface.Description.Contains("Juniper Networks Virtual Adapter") | |
&& Interface.OperationalStatus == OperationalStatus.Up) | |
{ | |
return true; | |
} | |
} | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment