Pages

Showing posts with label VBScript to find MAC address. Show all posts
Showing posts with label VBScript to find MAC address. Show all posts

Tuesday 30 August 2011

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