Category Archives: get mac address

VBScript to find MAC Address of a machine

VBScript to find the MAC Address of Network Adaptors attached to a computer.

On Error Resume Next
Dim strComputer
Dim objWMIService
Dim colItems

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration")

For Each objItem in colItems
Wscript.Echo "MAC Address: " & objItem.MACAddress
Next
Advertisements