[Mono-list] get mac address using system.management
Gonzalo Paniagua Javier
gonzalo.mono at gmail.com
Mon Apr 13 17:17:11 EDT 2009
On Mon, 2009-04-13 at 09:11 -0700, tooty wrote:
> hi all,
> i used to get mac address of Ethernet adapter under windows, using the
> following code:
>
> //
> Dim mc As System.Management.ManagementClass
> Dim mo As ManagementObject
> mc = New ManagementClass("Win32_NetworkAdapterConfiguration")
> Dim moc As ManagementObjectCollection = mc.GetInstances()
> For Each mo In moc
> If mo.Item("IPEnabled") = True Then
> ListBox1.Items.Add("MAC address " &
> mo.Item("MacAddress").ToString())
> End If
> Next
> //
> now i have to do the same under Linux system.
>
> now, its obvious i wont find "Win32_NetworkAdapterConfiguration" under
> managementclass on Linux.
>
> so, can anyone tell me what is the wright method of managementclass that
> will let me get the network adapter properties?
It's better to send just one message to the two lists that separate
messages. I already answered to the one in mono-devel saying:
"You can use the classes in System.Net.NetworkInformation (see
NetworkInterface.GetPhysicalAddress). This will work on MS.NET too."
-Gonzalo
More information about the Mono-list
mailing list