Visual Basic.NET
  Home arrow Visual Basic.NET arrow Page 5 - Retrieving Networking Configuration Inform...
Click Here
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Actuate Whitepapers 
VeriSign Whitepapers 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
VISUAL BASIC.NET

Retrieving Networking Configuration Information Using Visual Basic.NET and VBScript
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 10
    2006-01-11

    Table of Contents:
  • Retrieving Networking Configuration Information Using Visual Basic.NET and VBScript
  • How to List all IPAddresses of a computer using Visual Basic.NET – the code
  • How to retrieve MAC address and other miscellaneous network information using Visual Basic.NET – preparing the wrapper
  • How to retrieve MAC address and other miscellaneous network information using Visual Basic.NET – the code
  • How to retrieve Network Client Information using Visual Basic.NET
  • How to retrieve Win Proxy Information using Visual Basic.NET

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
    Iron Speed
     
    ADVERTISEMENT

    At the virtual BlackBerry Technical Seminar 2008, you can ask your development questions directly of Research In Motion® (RIM) experts, and take advantage of learning opportunities designed uniquely for BlackBerry solution developers. Register Today!

    Retrieving Networking Configuration Information Using Visual Basic.NET and VBScript - How to retrieve Network Client Information using Visual Basic.NET


    (Page 5 of 6 )

    Before getting the information on “Network Clients” installed on your computer, we need to create a wrapper to store the same information.  Let us proceed with creating a wrapper:

     Public Function getNetworkClientStructure() As DataTable
            Dim dt As New DataTable
            dt.Columns.Add(New DataColumn("Caption"))
            dt.Columns.Add(New DataColumn("Description"))
            dt.Columns.Add(New DataColumn("InstallDate"))
            dt.Columns.Add(New DataColumn("Manufacturer"))
            dt.Columns.Add(New DataColumn("Name"))
            Return dt
        End Function

    The following method “addNetworkClient” adds a single row based on the structure you create for the data table using the above method.

        Public Sub addNetworkClient(ByRef dt As DataTable, ByVal Caption As String, ByVal Description As String, ByVal InstallDate As String, ByVal Manufacturer As String, ByVal Name As String)
            Dim dr As DataRow
            dr = dt.NewRow
            dr("Caption") = Caption
            dr("Description") = Description
            dr("InstallDate") = InstallDate
            dr("Manufacturer") = Manufacturer
            dr("Name") = Name
            dt.Rows.Add(dr)
        End Sub

    Once you complete the creation of wrapper, the following VB.NET code should support it with some minimum information of “NetworkClients” available on your system.

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
     
            Try
                Dim searcher As New ManagementObjectSearcher( _
                    "root\CIMV2", _
                    "SELECT * FROM Win32_NetworkClient")
                Dim dt As DataTable = globals.getNetworkClientStructure
                For Each queryObj As ManagementObject In searcher.Get()
    globals.addNetworkClient(dt, queryObj("Caption"), queryObj("Description"), queryObj("InstallDate"), queryObj("Manufacturer"), queryObj("Name"))
                Next
                Me.DataGrid1.DataSource = dt
            Catch err As Exception
                MessageBox.Show("An error occurred while querying for WMI data: " & err.Message)
            End Try
     
        End Sub

    You can achieve the same thing with VBScript as follows:

    strComputer = "."
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
    Set colItems = objWMIService.ExecQuery( _
        "SELECT * FROM Win32_NetworkClient",,48)
    For Each objItem in colItems
        Wscript.Echo "Caption: " & objItem.Caption
        Wscript.Echo "Description: " & objItem.Description
        Wscript.Echo "InstallDate: " & objItem.InstallDate
        Wscript.Echo "Manufacturer: " & objItem.Manufacturer
        Wscript.Echo "Name: " & objItem.Name
    Next

    More Visual Basic.NET Articles
    More By Jagadish Chaterjee


       · [i]This article explains how to retrieve “Network settings” information dynamically...
       · This is a very good article, but a little insight on adding a reference for...
       · Hello,Actually, within the same article I already added the following...
     

    VISUAL BASIC.NET ARTICLES

    - Working with Classes and Properties for Game...
    - Working with Loops, Arrays, and Collections ...
    - Learning Loops in VB.NET for Game Development
    - Learning VB.NET: Working with Variables, Con...
    - The Basics of VB.NET Through Text Game Devel...
    - Learning VB.NET Through Text Game Development
    - Types of Operators in Visual Basic
    - Operators
    - Understanding Custom Events using Visual Bas...
    - Polymorphism using Abstract Classes in Visua...
    - Shadowing using Shadows in Visual Basic.NET ...
    - Overloading and Overriding in Visual Basic.N...
    - More on Controlling Windows Fax Services Usi...
    - Programmatically Controlling Windows Fax Ser...
    - Focusing on Forms and Menus in Visual Basic

    Iron Speed




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway