Sunday, October 09, 2005 1:58 AM bart

Coding Webcast - Network configuration tool with WMI

In my previous post titled "Netsh madness" I expressed my intention to create a simple tool to change network settings on Windows Server 2003 for both my home office and a remote location. Because netsh didn't solve the problem completely, I decided to try to find my luck in WMI, with success. In this post, I'll outline the steps to do this in Visual Studio:

  1. Download the WMI Extensions for Visual Studio .NET 2003. In Visual Studio 2005, this will come with the product.
  2. Create a new Visual Studio project, e.g. a Windows Forms app.
  3. Go to the Server Explorer, , Management Classes, Network Adapters and locate the network adapter of your choice.
  4. Expand the node of the network adapter and expand Network Adapter Settings. The child of this node is a WMI instance of "Win32_NetworkAdapterConfiguration" and is the one you're looking for. Drag and drop it on a designer surface. (Tip: right-click to see the available methods on the management class and to test these).
  5. Now write code that calls the various management operation methods that are available. For this particular example, you'll be interested in EnableStatic, SetGateways and SetDNSServerSearchOrder.

A video capture of the entire process is available on my website, over here. This is my first video capture on my website and I guess I'll do some more of these later on. Notice the video capture was created using the Windows Media Encoder tool with no 3rd party tools involved. You can download Windows Media Encoder for free. | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

Filed under:


# re: Netsh madness

Monday, October 17, 2005 11:05 PM by TrackBack