D
david
Hi All,
I have to get the MAC address in my program. But I didn't have the correct
property name of management object. And I don't know how to get it. Can some
one help me?
Below is my code.
Thanks,
ManagementClass adapters = new ManagementClass("Win32_NetworkAdapter");
string mac = "";
adapters.Get();
int ix =adapters.Properties.Count;
ix = adapters.Properties.Count;
foreach (ManagementObject adapter in adapters.GetInstances())
{
mac = adapter["Name"].ToString() + " " ;
mac += adapter["MACAddress"].ToString(); <--- crashed here,
propertyname is wrong.
I have to get the MAC address in my program. But I didn't have the correct
property name of management object. And I don't know how to get it. Can some
one help me?
Below is my code.
Thanks,
ManagementClass adapters = new ManagementClass("Win32_NetworkAdapter");
string mac = "";
adapters.Get();
int ix =adapters.Properties.Count;
ix = adapters.Properties.Count;
foreach (ManagementObject adapter in adapters.GetInstances())
{
mac = adapter["Name"].ToString() + " " ;
mac += adapter["MACAddress"].ToString(); <--- crashed here,
propertyname is wrong.