S
shawkee
Anyone knows how to read the MAC address on the network
card in .NET?
card in .NET?
-----Original Message-----
ManagementObjectSearcher query = null;
ManagementObjectCollection queryCollection = null;
try
{
query = new ManagementObjectSearcher("SELECT * FROM
Win32_NetworkAdapterConfiguration") ;
queryCollection = query.Get();
foreach( ManagementObject mo in queryCollection )
{
if(mo["MacAddress"] != null)
{
Console.WriteLine(mo["MacAddress"].ToString());
}
}
}
catch(Exception ex)
{
Console.WriteLine(ex.Source);
Console.WriteLine(ex.Message);
}
shawkee said:Anyone knows how to read the MAC address on the network
card in .NET?
.
thanks!!!
The ManagementObjectSearcher accept a string looks like a
SQL command. Is there any other
than "Win32_NetworkAdapterConfiguration" we can query?-----Original Message-----
ManagementObjectSearcher query = null;
ManagementObjectCollection queryCollection = null;
try
{
query = new ManagementObjectSearcher("SELECT * FROM
Win32_NetworkAdapterConfiguration") ;
queryCollection = query.Get();
foreach( ManagementObject mo in queryCollection )
{
if(mo["MacAddress"] != null)
{
Console.WriteLine(mo["MacAddress"].ToString());
}
}
}
catch(Exception ex)
{
Console.WriteLine(ex.Source);
Console.WriteLine(ex.Message);
}
shawkee said:Anyone knows how to read the MAC address on the network
card in .NET?
.