title: How do I uniquely identify only network connections that are *not* VPN connections?
body: <p>I'm trying to track all current network connections at run time, but I want to exclude VPN connections.</p>
  
  <p>I need to be able to identify the network(s) being connected to, as well, so I'm using <code>NetworkListManagerClass()</code> to build a list of current connections:</p>
  
  <pre><code>var manager = new NetworkListManagerClass();
  var connectedNetworks = manager.GetNetworks(NLM_ENUM_NETWORK.NLM_ENUM_NETWORK_CONNECTED).Cast&lt;INetwork&gt;();
  </code></pre>
  
  <p>I believe I can determine if a connection adapter is for a VPN by examining the <code>NetworkInterfaceType</code> of the <code>NetworkInterface</code> class:</p>
  
  <pre><code>NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces().Where(n =&gt; n.OperationalStatus == OperationalStatus.Up).ToArray();
  
        foreach (NetworkInterface n in interfaces)
        {
            if (n.NetworkInterfaceType == NetworkInterfaceType.Tunnel || n.NetworkInterfaceType == NetworkInterfaceType.PPP)
            {
  
            }
        }
  </code></pre>
  
  <p>However, it isn't enough for me to just know that an interface is or is not a VPN.  I need to be able to track details about the network that the non-VPN interfaces are <strong>connected</strong> to.</p>
  
  <p>For example:</p>
  
  <p>We'll call my work network "officenetwork".  We'll call my home network "homenetwork".</p>
  
  <p>If I'm at work, I can see I'm connected to <em>officenetwork</em> by examining <code>NetworkListManagerClass</code> based off the <code>NLM_ENUM_NETWORK_CONNECTED</code> status.  My application should know that <em>officenetwork</em> is my current local network, and will store and reference settings specific to that network.</p>
  
  <p>Similarly, if I'm at home, I should be able to see <em>homenetwork</em>, and store and reference a different set of settings specific to that network.</p>
  
  <p>However, if I'm at home, and I use a VPN to connect to <em>officenetwork</em>, examining <code>NetworkListManagerClass</code> based off the <code>NLM_ENUM_NETWORK_CONNECTED</code> status will show both <em>homenetwork</em> and <em>officenetwork</em>.  Since the connection to <em>officenetwork</em> is a VPN, I need to ignore it, and only store and reference the settings for <em>homenetwork</em>.</p>
  
  <p>This software will be for users who will connect to networks I know nothing about, so I cannot assume connection data for specific VPN's or networks.</p>
  
  <p>How can I check current network connections and identify only networks that are <strong>not</strong> VPN connections, so I can store custom settings for that network? </p>