Get the Available Network Connections Using WMI

March 30, 2009 | By | 4 Comments

Available Networks

Windows Management Instrumentation (WMI) makes querying Windows for system and devices information easy. And this is even easier with System.Management assembly. The code listed loads the names of the network connections in a ListBox, which when clicked displays all the available properties in a ListView.

To get the code to work add a reference to System.Management. The form’s Load event retrieves the list of network connections that use IP and loops through them adding each one’s description property to the ListBox. The ListBox’s SelectedIndexChanged event executes the same query again but adds to the WHERE clause the Description property. The result is the object selected by the user.

 

Download Source Code

 



Related Posts:

Filed in: WinForms | Tags: , ,

Comments (4)

Links to this Post

  1. DotNetShoutout | April 5, 2009
  1. it’s nice to stay in your blog..

  2. Ralph Bautista

    will this detect if I am still connected online? or will it only detect the network connections available?

  3. @Ralph: No this only lists the available connections, to check if the computer is connected to a network (whether the Internet or a local network) use:

    NetworkInterface.GetIsNetworkAvailable()

Leave a Reply

Trackback URL | RSS Feed for This Entry