Results 1 to 11 of 11

Thread: [RESOLVED] Extract the MAC address of a remote computer

  1. #1

    Thread Starter
    Addicted Member alexia_net's Avatar
    Join Date
    Jun 2006
    Posts
    216

    Resolved [RESOLVED] Extract the MAC address of a remote computer

    Hi. I am new in VB .Net, i have use VB6 untile now. Now i am using VB .Net 2005. I am trying to rewrite a program from VB6. How do i extract the MAC address of a remote computer knowing its name and IP? Thank you!
    Last edited by alexia_net; Aug 19th, 2008 at 06:46 AM.

  2. #2
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,754

    Re: Extract the MAC address of a remote computer

    Is this a computer on the same network or a different network?
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  3. #3

    Thread Starter
    Addicted Member alexia_net's Avatar
    Join Date
    Jun 2006
    Posts
    216

    Re: Extract the MAC address of a remote computer

    Quote Originally Posted by dbasnett
    Is this a computer on the same network or a different network?
    Thank you for your reply. Same network.

  4. #4
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: Extract the MAC address of a remote computer

    You should be able to use WMI to query the remote hosts for information about its NICs, and get its MAC addresses that way.

    The Address Resolution Protocol (ARP) is what all computers and routers today use to retrieve other hosts MAC addresses. Using the ARP protocol directly on a host might be another approach.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  5. #5

    Thread Starter
    Addicted Member alexia_net's Avatar
    Join Date
    Jun 2006
    Posts
    216

    Re: Extract the MAC address of a remote computer

    Quote Originally Posted by Atheist
    You should be able to use WMI to query the remote hosts for information about its NICs, and get its MAC addresses that way.

    The Address Resolution Protocol (ARP) is what all computers and routers today use to retrieve other hosts MAC addresses. Using the ARP protocol directly on a host might be another approach.
    Thank you for your reply. I am new with VB .Net. I have no idea how to do it.

  6. #6
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,754

    Re: Extract the MAC address of a remote computer

    here is a link with wmi, but that assumes that the other computer is windows based.

    http://forums.microsoft.com/MSDN/Sho...84212&SiteID=1

    why not run dos commands from vb, ping the computer, then
    arp -a
    and parse the output.

    process.start
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  7. #7
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,754

    Re: Extract the MAC address of a remote computer

    here is a link for the Process class

    http://msdn.microsoft.com/en-us/libr...rs(VS.85).aspx
    Last edited by dbasnett; Aug 19th, 2008 at 11:47 AM.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  8. #8

    Thread Starter
    Addicted Member alexia_net's Avatar
    Join Date
    Jun 2006
    Posts
    216

    Thumbs up Re: Extract the MAC address of a remote computer

    Thank you. I have adjusted it a little because i was getting some errors.
    here it is:
    Code:
            Dim ComputerName As String
            ComputerName = "test"
    
            Dim theManagementScope As New Management.ManagementScope("\\" & ComputerName & "\root\cimv2")
            Dim theQueryString As String
            theQueryString = "SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = 1 "
    
            Dim theObjectQuery As New Management.ObjectQuery(theQueryString)
    
            Dim theSearcher As New Management.ManagementObjectSearcher(theManagementScope, theObjectQuery)
            Dim theResultsCollection As Management.ManagementObjectCollection = theSearcher.Get()
    
            For Each currentResult As Management.ManagementObject In theResultsCollection
                MessageBox.Show(currentResult("MacAddress").ToString())
            Next

  9. #9
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: Extract the MAC address of a remote computer

    Good to see you succeeded. Im in the middle of writing a DLL for you to send ARPs to other hosts, I'll finish it and post it here in case any one else is interested.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  10. #10
    New Member
    Join Date
    Oct 2008
    Posts
    1

    Re: [RESOLVED] Extract the MAC address of a remote computer

    Hi all
    help me
    please anyone help me code or program vb6 to get MAC address from remote client with use vb6 please help me
    your friends Habbeb send code or program on my email :friendoflove25@yahoo.com
    thank you ...thank you

  11. #11
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,754

    Re: [RESOLVED] Extract the MAC address of a remote computer

    iphlpapi.dll
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

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