| | |
Get MAC Address
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
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.
•
•
•
•
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
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.
![]() |
Similar Threads
- 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
| Thread Tools | Search this Thread |
.net access algorithm array backup barchart bitmap box broadcast c# check checkbox client combobox control conversion csharp custom database databasesearch datagrid datagridview datagridviewcheckbox dataset datetime degrees development draganddrop drawing dynamiccreation encryption enum equation excel file form format formatting forms function gdi+ hospitalmanagementsystems httpwebrequest image index input install interface java label list listbox mandelbrot math mouseclick mysql namevaluepairs operator path photoshop picturebox pixelinversion post powerpacks programming property radians regex remoting resource restore richtextbox running... server sleep soap socket sql stack statistics stream string table text textbox thread time timer update usercontrol validation visualstudio wait webbrowser windows winforms working wpf write xml





