Pages

Showing posts with label get mac address. Show all posts
Showing posts with label get mac address. Show all posts

Thursday, 21 June 2012

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