C# retreiving neworks card serial number

EFileTahi-A

Well-known member
Joined
Aug 8, 2004
Messages
539
Location
Portugal / Barreiro
Hello m8s, I need to retrieve the networks card manufacter serial key (which is unic). Can some one explain me in theory how to do this? Or point me to any turorial?

tks!
 
As a quick sample create a new project and add a listbox, at the top of the file do a
C#:
using system.Management
and also add a reference to system.Management.dll

then paste the following code into the form
C#:
private void Form1_Load(object sender, System.EventArgs e)
{
ManagementClass Netconfig = new ManagementClass("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection Nics = Netconfig.GetInstances();
foreach(ManagementObject Nic in Nics)
	{
	if((bool)Nic["IPEnabled"] == true)
	listBox1.Items.Add(string.Format("MAC address\t{0}",  Nic["MacAddress"].ToString()));
	Nic.Dispose();
	}
}
 
Last edited by a moderator:
Back
Top