sunil_skc
Apr 5th, 2007, 01:11 PM
Hi
How can get MAC address by using Local IP Address ?
technogeek
Apr 11th, 2007, 12:06 PM
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.
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.