Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Get GUID of Network Card

Get GUID of Network Card

Scheduled Pinned Locked Moved C#
csharpsysadmin
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kamal Afridi
    wrote on last edited by
    #1

    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.

    P 1 Reply Last reply
    0
    • K Kamal Afridi

      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.

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      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.

      My blog | My articles

      K 1 Reply Last reply
      0
      • P Pete OHanlon

        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.

        My blog | My articles

        K Offline
        K Offline
        Kamal Afridi
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups