Results 1 to 3 of 3

Thread: Getting MAC using IP

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2007
    Posts
    20

    Getting MAC using IP

    Hi
    How can get MAC address by using Local IP Address ?

  2. #2

  3. #3
    New Member technogeek's Avatar
    Join Date
    Apr 2007
    Posts
    5

    Re: Getting MAC using IP

    Quote Originally Posted by sunil_skc
    Hi
    How can get MAC address by using Local IP Address ?

    Hey,
    Got some code snipet for you. It's not complete and it may be a bit confusing at first, but just save it as a .vbs file and run it. You'll have to enter in the IP address or Hostname of the system twice (for verification purposes), but it spits out the MAC of all available devices in your box. See code below.

    Code:
    On Error Resume Next
    
    Const wbemFlagReturnImmediately = &h10
    Const wbemFlagForwardOnly = &h20
    
    dim strComputers
    dim arrComputers
    strComputer = inputbox("Enter Computer Identifier Here")
    arrComputers = inputbox("Verify Computer Identifier Here")
    
    For Each strComputers In arrComputers
    
       Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
       Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapter", "WQL", _
                                              wbemFlagReturnImmediately + wbemFlagForwardOnly)
    
       For Each objItem In colItems
          WScript.Echo "Computer: " & strComputer & " /DeviceID: " & objItem.DeviceID & " /MACAddress: " & objItem.MACAddress & " /Manufacturer: " & objItem.Manufacturer
       Next
    Next
    It's not completely finished, I'm waiting on an answer back from one of the other forums. It'll do the job, but I want it to parse the info out to a text file and suppress the popup windows.

    Good Luck.

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