Results 1 to 2 of 2

Thread: Understanding MAC Addresses

  1. #1

    Thread Starter
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690

    Understanding MAC Addresses

    I want to use the MAC address for hardware authentication purposes. I found this (slightly modified) code on the web:
    PHP Code:
            private void btnGetMACAddress_Click(object senderSystem.EventArgs e)
            {
                
    ManagementObjectSearcher query null
                
    ManagementObjectCollection queryCollection null

                try 
                { 
                    
    query = new ManagementObjectSearcher("SELECT * FROM Win32_NetworkAdapterConfiguration") ; 
                    
    queryCollection query.Get(); 

                    foreach( 
    ManagementObject mo in queryCollection 
                    { 
                        if(
    mo["MacAddress"] != null
                        { 
                            
    MessageBox.Show(mo["MacAddress"].ToString()); 
                        } 
                    } 
                } 
                catch(
    Exception ex
                { 
                    
    MessageBox.Show(ex.Source); 
                    
    MessageBox.Show(ex.Message); 
                } 
            
            } 
    Now, that code seems to work just fine. But, it shows 5 MAC addresses on my machine. In my network connections, I have four "LAN or High-Speed Internet" connections. ipconfig /all shows me two connections (the two that are currently enabled). getmac from a command line shows me four connections, two that are enabled (so I get the MAC addresses for them).

    Anyone know where the fifth MAC address is coming from?

    Thanks,
    Mike

  2. #2

    Thread Starter
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    Answering my own question...

    Searching around, found all the members here http://msdn.microsoft.com/library/de...figuration.asp

    Adding this shows some more info:

    PHP Code:
    MessageBox.Show(mo["Caption"].ToString()); 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width