Here is a function I put together. Uses WMI(W32). Pulls a lot of info for network adapters.
Usage Example - TextBox1.Text = FuncNetworkAdapter()
Microsoft documentation on it is here -
Win32_NetworkAdapter class - Win32 apps | Microsoft Docs[
^]
[
^]
Imports System.Management has to go above the class declaration
The Imports declaration can be omitted if you go into project properties and reference. System.Management and System.Management.Instrumentation
Imports System.Management
Public Class Form1
Public Function FuncNetworkAdapter() As String
Dim Functmp = Nothing
FuncNetworkAdapter = Nothing
Try
Dim targ As String = "NetworkAdapter"
Dim searcher As New ManagementObjectSearcher("root\CIMV2", "SELECT * FROM Win32_" & targ)
For Each queryObj As ManagementObject In searcher.Get()
If queryObj("AdapterType") <> Nothing Then Functmp = Functmp + "AdapterType - " + CStr(queryObj("AdapterType")) + vbCrLf
If queryObj("AdapterTypeID") <> Nothing Then Functmp = Functmp + "AdapterTypeID - " + CStr(queryObj("AdapterTypeID")) + vbCrLf
If queryObj("AutoSense") <> Nothing Then Functmp = Functmp + "AutoSense - " + CStr(queryObj("AutoSense")) + vbCrLf
If queryObj("Availability") <> Nothing Then Functmp = Functmp + "Availability - " + GetNetworkAdapterAvailability(queryObj("Availability")) + vbCrLf
If queryObj("Caption") <> Nothing Then Functmp = Functmp + "Caption - " + CStr(queryObj("Caption")) + vbCrLf
If queryObj("ConfigManagerErrorCode") <> Nothing Then Functmp = Functmp + "ConfigManagerErrorCode - " + CStr(queryObj("ConfigManagerErrorCode")) + vbCrLf
If queryObj("ConfigManagerUserConfig") <> Nothing Then Functmp = Functmp + "ConfigManagerUserConfig - " + CStr(queryObj("ConfigManagerUserConfig")) + vbCrLf
If queryObj("CreationClassName") <> Nothing Then Functmp = Functmp + "CreationClassName - " + CStr(queryObj("CreationClassName")) + vbCrLf
If queryObj("Description") <> Nothing Then Functmp = Functmp + "Description - " + CStr(queryObj("Description")) + vbCrLf
If queryObj("DeviceID") <> Nothing Then Functmp = Functmp + "DeviceID - " + CStr(queryObj("DeviceID")) + vbCrLf
If queryObj("ErrorCleared") <> Nothing Then Functmp = Functmp + "ErrorCleared - " + CStr(queryObj("ErrorCleared")) + vbCrLf
If queryObj("ErrorDescription") <> Nothing Then Functmp = Functmp + "ErrorDescription - " + CStr(queryObj("ErrorDescription")) + vbCrLf
If queryObj("GUID") <> Nothing Then Functmp = Functmp + "GUID - " + CStr(queryObj("GUID")) + vbCrLf
If queryObj("Index") <> Nothing Then Functmp = Functmp + "Index - " + CStr(queryObj("Index")) + vbCrLf
If queryObj("InstallDate") <> Nothing Then Functmp = Functmp + "InstallDate - " + CStr(queryObj("InstallDate")) + vbCrLf
If queryObj("Installed") <> Nothing Then Functmp = Functmp + "Installed - " + CStr(queryObj("Installed")) + vbCrLf
If queryObj("InterfaceIndex") <> Nothing Then Functmp = Functmp + "InterfaceIndex - " + CStr(queryObj("InterfaceIndex")) + vbCrLf
If queryObj("LastErrorCode") <> Nothing Then Functmp = Functmp + "LastErrorCode - " + CStr(queryObj("LastErrorCode")) + vbCrLf
If queryObj("MACAddress") <> Nothing Then Functmp = Functmp + "MACAddress - " + CStr(queryObj("MACAddress")) + vbCrLf
If queryObj("Manufacturer") <> Nothing Then Functmp = Functmp + "Manufacturer - " + CStr(queryObj("Manufacturer")) + vbCrLf
If queryObj("MaxNumberControlled") <> Nothing Then Functmp = Functmp + "MaxNumberControlled - " + CStr(queryObj("MaxNumberControlled")) + vbCrLf
If queryObj("MaxSpeed") <> Nothing Then Functmp = Functmp + "MaxSpeed - " + CStr(queryObj("MaxSpeed")) + vbCrLf
If queryObj("Name") <> Nothing Then Functmp = Functmp + "Name - " + CStr(queryObj("Name")) + vbCrLf
If queryObj("NetConnectionID") <> Nothing Then Functmp = Functmp + "NetConnectionID - " + CStr(queryObj("NetConnectionID")) + vbCrLf
If queryObj("NetConnectionStatus") <> Nothing Then Functmp = Functmp + "NetConnectionStatus - " + CStr(queryObj("NetConnectionStatus")) + vbCrLf
If queryObj("NetEnabled") <> Nothing Then Functmp = Functmp + "NetEnabled - " + CStr(queryObj("NetEnabled")) + vbCrLf
If queryObj("PermanentAddress") <> Nothing Then Functmp = Functmp + "PermanentAddress - " + CStr(queryObj("PermanentAddress")) + vbCrLf
If queryObj("PhysicalAdapter") <> Nothing Then Functmp = Functmp + "PhysicalAdapter - " + CStr(queryObj("PhysicalAdapter")) + vbCrLf
If queryObj("PNPDeviceID") <> Nothing Then Functmp = Functmp + "PNPDeviceID - " + CStr(queryObj("PNPDeviceID")) + vbCrLf
If queryObj("PowerManagementSupported") <> Nothing Then Functmp = Functmp + "PowerManagementSupported - " + CStr(queryObj("PowerManagementSupported")) + vbCrLf
If queryObj("ProductName") <> Nothing Then Functmp = Functmp + "ProductName - " + CStr(queryObj("ProductName")) + vbCrLf
If queryObj("ServiceName") <> Nothing Then Functmp = Functmp + "ServiceName - " + CStr(queryObj("ServiceName")) + vbCrLf
If queryObj("Speed") <> Nothing Then Functmp = Functmp + "Speed - " + CStr(queryObj("Speed")) + vbCrLf
If queryObj("Status") <> Nothing Then Functmp = Functmp + "Status - " + CStr(queryObj("Status")) + vbCrLf
If queryObj("StatusInfo") <> Nothing Then Functmp = Functmp + "StatusInfo - " + CStr(queryObj("StatusInfo")) + vbCrLf
If queryObj("SystemCreationClassName") <> Nothing Then Functmp = Functmp + "SystemCreationClassName - " + CStr(queryObj("SystemCreationClassName")) + vbCrLf
If queryObj("SystemName") <> Nothing Then Functmp = Functmp + "SystemName - " + CStr(queryObj("SystemName")) + vbCrLf
If queryObj("TimeOfLastReset") <> Nothing Then Functmp = Functmp + "TimeOfLastReset - " + CStr(queryObj("TimeOfLastReset")) + vbCrLf
Application.DoEvents()
Functmp = Functmp + "----------" + vbCrLf
Next
Catch err As ManagementException
MessageBox.Show("An error occurred while querying for WMI data: " & err.Message)
End Try
FuncNetworkAdapter = Functmp
End Function
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
TextBox2.Text = FuncNetworkAdapter()
End Sub
End Class