| | |
Get MAC Address
Please support our C# advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
![]() |
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 animation array bitmap box c# check checkbox client combobox control conversion csharp customactiondata database datagrid datagridview dataset datastructure date/time datetime datetimepicker degrees directrobot dll draganddrop drawing encryption enum excel file filename files form format formbox forms function gdi+ gis gtk hash image input install java label list mandelbrot math mouseclick mp3 mysql native operator outlook2003 packaging path photoshop picturebox pixelinversion pixelminversion post print process programming radians regex remoting richtextbox safari server sleep snooze socket sql statistics string table tables tcp text textbox thread time timer update usercontrol usercontrols validation visualstudio webbrowser webcam wfa wia winforms wpf xml





