Retrieving Networking Configuration Information Using Visual Basic.NET and VBScript - How to retrieve MAC address and other miscellaneous network information using Visual Basic.NET – preparing the wrapper
(Page 3 of 6 )
In the previous section, I tried to retrieve only basic IP related information. But, if we need to go into the depth of the IP configuration, we still need to delve into a few more important properties. Before starting with the code, we need to have a separate wrapper for this concept again. The wrapper would look something like this:
Public Function getNetworkConfigStructure() As DataTable
Dim dt As New DataTable
dt.Columns.Add(New DataColumn("Caption"))
dt.Columns.Add(New DataColumn("IPFilterSecurityEnabled"))
dt.Columns.Add(New DataColumn("IPPortSecurityEnabled"))
dt.Columns.Add(New DataColumn("IPXAddress"))
dt.Columns.Add(New DataColumn("IPXEnabled"))
dt.Columns.Add(New DataColumn("IPXNetworkNumber"))
dt.Columns.Add(New DataColumn("MACAddress"))
dt.Columns.Add(New DataColumn("WINSPrimaryServer"))
dt.Columns.Add(New DataColumn("WINSSecondaryServer"))
Return dt
End Function
The following method “addNetworkconfig” adds a single row based on the structure you create for the data table using the above method.
Public Sub addNetworkConfig(ByRef dt As DataTable, ByVal Caption As String, ByVal IPFilterSecurityEnabled As String, ByVal IPPortSecurityEnabled As String, ByVal IPXAddress As String, ByVal IPXEnabled As String, ByVal IPXNetworkNumber As String, ByVal MACAddress As String, ByVal WINSPrimaryServer As String, ByVal WINSSecondaryServer As String)
Dim dr As DataRow
dr = dt.NewRow
dr("Caption") = Caption
dr("IPFilterSecurityEnabled") = IPFilterSecurityEnabled
dr("IPPortSecurityEnabled") = IPPortSecurityEnabled
dr("IPXAddress") = IPXAddress
dr("IPXEnabled") = IPXEnabled
dr("IPXNetworkNumber") = IPXNetworkNumber
dr("MACAddress") = MACAddress
dr("WINSPrimaryServer") = WINSPrimaryServer
dr("WINSSecondaryServer") = WINSSecondaryServer
dt.Rows.Add(dr)
End Sub
Next: How to retrieve MAC address and other miscellaneous network information using Visual Basic.NET – the code >>
More Visual Basic.NET Articles
More By Jagadish Chaterjee