Note that there are some explanatory texts on larger screens.

plurals
  1. POGet the properties of the current network connection
    primarykey
    data
    text
    <p>How do you determine or examine the connection profile of the current network connection (if any)?</p> <p>Specifically, I need to determine if the current connection is to a private or public network, and from there determine whether network discovery is turned on or off.</p> <p>It seems like this information is readily available in a Windows Store app via the <a href="http://msdn.microsoft.com/en-us/library/windows/apps/windows.networking.connectivity.networkinformation.getconnectionprofiles.aspx" rel="nofollow">Windows.Networking.Connectivity.NetworkInformation.GetConnectionProfiles()</a> or <a href="http://msdn.microsoft.com/en-us/library/windows/apps/windows.networking.connectivity.networkinformation.getinternetconnectionprofile.aspx" rel="nofollow">NetworkInformation.GetInternetConnectionProfile()</a> functions, <strong>but this is a standard desktop app</strong> that must run on Win 7 and Server 2008 as well as Win 8 and Server 2012.</p> <p><a href="http://msdn.microsoft.com/en-us/library/system.net.networkinformation.networkinterface.getallnetworkinterfaces.aspx" rel="nofollow">Enumerating the NICs</a> on a machine is not a problem, but this doesn't solve my issue - I need to get the properties of the <em>connection</em>, not the <em>physical device</em>. </p> <p>Is there an inbuilt way to do this with the .Net framework? Alternatively can it be done with WMI? Or as a crude alternative, can it be done by invoking the <code>netsh</code> command (although this seems to depend on the <a href="http://technet.microsoft.com/en-us/library/cc727725%28v=ws.10%29.aspx" rel="nofollow">dot3svc</a> and/or <a href="http://technet.microsoft.com/en-us/library/cc730957.aspx" rel="nofollow">wlansvc</a> services to be running)?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload