•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C# section within the Software Development category of DaniWeb, a massive community of 401,619 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,765 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Views: 35730 | Replies: 2
![]() |
•
•
Join Date: Apr 2005
Location: Milwaukee, WI
Posts: 156
Reputation:
Rep Power: 4
Solved Threads: 3
Use the Management Class object in .NET.
ManagementClass oMClass = new ManagementClass ("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection colMObj = oMCLass.GetInstances();
foreach(ManagementObject objMO in colMObj)
{
Console.WriteLine(objMO["MacAddress"].ToString());
}
Makes sense?
Andy
ManagementClass oMClass = new ManagementClass ("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection colMObj = oMCLass.GetInstances();
foreach(ManagementObject objMO in colMObj)
{
Console.WriteLine(objMO["MacAddress"].ToString());
}
Makes sense?
Andy
Nobody believes the official spokesman, but everybody trusts an unidentified source.
-- Please do not PM me with questions about a thread. If you respond to a thread, then everyone can benefit.
-- Please do not PM me with questions about a thread. If you respond to a thread, then everyone can benefit.
•
•
Join Date: Apr 2005
Location: Milwaukee, WI
Posts: 156
Reputation:
Rep Power: 4
Solved Threads: 3
•
•
•
•
Use the Management Class object in .NET.
ManagementClass oMClass = new ManagementClass ("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection colMObj = oMCLass.GetInstances();
foreach(ManagementObject objMO in colMObj)
{
Console.WriteLine(objMO["MacAddress"].ToString());
}
Makes sense?
Andy
You might want to also add
Console.WriteLine(objMO["Caption"].ToString());
to your test before the mac address so that you know which devices you are looking at.
Also, don't forget to use try/catch blocks on these as a NullPointerReference will kill the app.
Andy
Nobody believes the official spokesman, but everybody trusts an unidentified source.
-- Please do not PM me with questions about a thread. If you respond to a thread, then everyone can benefit.
-- Please do not PM me with questions about a thread. If you respond to a thread, then everyone can benefit.
![]() |
•
•
•
•
•
•
•
•
DaniWeb C# Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
apple blog bugs codeweavers companies computing core crossover daniweb defcon emulation hackers hacks hate hoax iphone jbennet kevin rose leopard linux mac macs microsoft news office os os x osx parallels pc pro processor secret security serunson tiger trojan unix virtualization vista vmware vulnerabilities wifi windows wine
- Get MAC ADDRESS from VC++ or c language (C++)
- Relationship between Asset, Mac Address and IP address (Database Design)
- changing mac address (Networking Hardware Configuration)
- MAC Address (*nix Software)
Other Threads in the C# Forum
- Previous Thread: How to Block Save button in FileDownload dialog box ?
- Next Thread: Getting a C# program with a manifest file to run in the debugger


Linear Mode