Get GUID of Network Card
C#
3
Posts
2
Posters
0
Views
1
Watching
-
Is there any code in C# to get GUID of network card. Thanks.
The great pleasure in life is doing what people say you cannot do.
-
Is there any code in C# to get GUID of network card. Thanks.
The great pleasure in life is doing what people say you cannot do.
GUID of network card? Do you mean the Mac Address? If so, you can use WMI to retrieve it:
public string GetMACAddress() { ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration"); ManagementObjectCollection moc = mc.GetInstances(); string address = string.Empty; foreach (ManagementObject mo in moc) { if (MACAddress == string.Empty) { if ((bool)mo["IPEnabled"] == true) address = mo["MacAddress"].ToString(); } mo.Dispose(); } address = address.Replace(":", string.Empty); return address; }
Deja View - the feeling that you've seen this post before.
-
GUID of network card? Do you mean the Mac Address? If so, you can use WMI to retrieve it:
public string GetMACAddress() { ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration"); ManagementObjectCollection moc = mc.GetInstances(); string address = string.Empty; foreach (ManagementObject mo in moc) { if (MACAddress == string.Empty) { if ((bool)mo["IPEnabled"] == true) address = mo["MacAddress"].ToString(); } mo.Dispose(); } address = address.Replace(":", string.Empty); return address; }
Deja View - the feeling that you've seen this post before.
Thanks Pete O'Hanlon for your reply, but i need GUID which also called UUID. Any Idea please.
The great pleasure in life is doing what people say you cannot do.