how to get the MAC address by .net program if the OS is win98? by anonymous

anonymous
Sat Jan 10 16:55:19 CST 2004

Here is C# example to view MAC address of your network
devices:


System.Management.ManagementObjectSearcher query =
null;

System.Management.ManagementObjectCollection
queryCollection = null;

try
{
query = new
System.Management.ManagementObjectSearcher("SELECT * FROM
Win32_NetworkAdapterConfiguration") ;

queryCollection = query.Get
();

foreach(
System.Management.ManagementObject mo in queryCollection )
{
if(mo
["MacAddress"] != null)
{

Console.WriteLine(mo["MacAddress"].ToString());
}
}
}
catch(Exception ex)
{
Console.WriteLine
(ex.Source);
Console.WriteLine
(ex.Message);
}

>-----Original Message-----
>
>
>.
>

how to get the MAC address by .net program if the OS is win98? by Danny

Danny
Sat Jan 10 17:12:32 CST 2004

this is exmple of retrieing MAC address of all network
devices. in order to run it sucessfully on Win98 you
should install DotNet Framework and WMI SDK fro 95/98/NT
and this is the link:
http://www.microsoft.com/downloads/details.aspx?
familyid=e4182002-03be-4e77-997a-
3b7cf356e9c9&displaylang=en


System.Management.ManagementObjectSearcher query =
null;

System.Management.ManagementObjectCollection
queryCollection = null;

try
{
query = new
System.Management.ManagementObjectSearcher("SELECT * FROM
Win32_NetworkAdapterConfiguration") ;

queryCollection = query.Get
();

foreach(
System.Management.ManagementObject mo in queryCollection )
{
if(mo
["MacAddress"] != null)
{

Console.WriteLine(mo["MacAddress"].ToString());
}
}
}
catch(Exception ex)
{
Console.WriteLine
(ex.Source);
Console.WriteLine
(ex.Message);
}
>-----Original Message-----
>
>
>.
>