Option Strict On
Option Explicit On
Imports System
Imports System.Management
Public Class ConsoleApp
Shared Sub Main()
Network.EnumNetworkAdapters()
End Sub
End Class
Public Class Network
Public Shared Sub EnumNetworkAdapters()
Dim query As ManagementObjectSearcher = New ManagementObjectSearcher("SELECT * FROM Win32_NetworkAdapterConfiguration")
Dim queryCollection As ManagementObjectCollection = query.Get()
Dim mo As ManagementObject
Dim s As String
For Each mo In queryCollection
Console.WriteLine("'{0}", mo.ClassPath)
Console.WriteLine("'{0}", mo.Options)
Console.WriteLine("Index '{0}", mo("Index"))
Console.WriteLine("Description '{0}", mo("Description"))
Console.WriteLine("MacAddress '{0}", mo("MacAddress"))
If (CType(mo("IPEnabled"), Boolean) = True) Then
Dim addresses() As String = CType(mo("IPAddress"), String())
Dim subnets() As String = CType(mo("IPSubnet"), String())
Console.WriteLine("DNS Host '{0}", mo("DNSHostName"))
Console.WriteLine("DNS Domain '{0}", mo("DNSDomain"))
For Each s In addresses
Console.WriteLine("IP Address '{0}", s)
Next
For Each s In subnets
Console.WriteLine("IP Subnet '{0}", s)
Next
End If
Next
End Sub
End Class
sábado, 17 de diciembre de 2011
Información del Sistema - Listar Adaptadores de Red VB.NET
Home »
Programadores
,
vb2010
,
Visual Basic .Net
,
WMI
»
Información del Sistema - Listar Adaptadores de Red VB.NET
COMO LISTAR MIS ADAPTADORES O TARJETAS DE RED EN VB.NET
No hay comentarios:
Publicar un comentario