retrieving ethernet address of the machine

  • Thread starter Thread starter Ram
  • Start date Start date
R

Ram

Hi,
I would like to know if there is a method to retieve the
hostid ( ethernet card address) of a machine by using a
windows API? Basically this function should return the
Ethernet address (s) of the machine.

Any help is greatly appreciated. Thanks
 
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set IPConfigSet = objWMIService.ExecQuery _
("Select IPAddress from Win32_NetworkAdapterConfiguration where
IPEnabled=TRUE")
For Each IPConfig in IPConfigSet
If Not IsNull(IPConfig.IPAddress) Then
For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
WScript.Echo IPConfig.IPAddress(i)
Next
End If
Next

This will give you the IP address. Did you want the MAC?
 
Back
Top