Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get a remote machines mac address

Status
Not open for further replies.

teckiejon

Technical User
Feb 25, 2004
47
GB
I've been tasked to find the Mac Addresses for a list of remote machines on our network either by IP address or machine name. Ideally I would like to input them into a text file or spreadsheet. I am new to Vb script so understand the basics but this is a bit much for me. Could anybody out there lend a hand?
 
Have found some helpful code in an older post so this is what I have so far, will try to tidy it up a bit

Dim strMAC

StrMAC = InputBox("Enter the machine name to test:")

Set WMI = GetObject("winmgmts:" & "!\\"& StrMAC &"\root\cimv2")

Set NICs = WMI.ExecQuery("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = True")

For Each NIC in NICs
if not isnull(NIC.IPAddress) then
for x=lbound(NIC.IPAddress) to ubound(NIC.IPAddress)
msgbox NIC.Description & " MAC Address " & x & ": " & NIC.MACAddress(x)
next
end if
next

Set NICs = Nothing: Set WMI = Nothing
 
looks pretty cool, you might find the ARP dos command quicker though, well so the network geek opposite me says :)
 
Cheeers Mr Movie will ask the network geek who sits opposite me about it
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top