Get Network card description and Mac addressTag(s): WinAPI/Registry
Using VBScript
OLEObject ole_wsh
Any la_usb[]
string ls_message
ole_wsh = CREATE OLEObject
ole_wsh.ConnectToNewObject("MSScriptControl.ScriptControl")
ole_wsh.Language = "vbscript"
ole_wsh.AddCode('Function rtnMACAddresses()~r~n' &
+ 'MACAddressList = "" ~r~n' + &
+ 'strComputer = "."~r~n' + &
+ 'Set objWMIService = ' + &
+ ' GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _~r~n' &
+ '& strComputer & "\root\cimv2")~r~n' &
+ 'Set colItems = ' &
+ ' objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = ~'TRUE~'")~r~n' &
+ 'For Each objItem in colItems~r~n' &
+ 'MACAddressList = MACAddressList & " | " & objItem.Description & " = " & objItem.MACAddress ~r~n' &
+ 'Next~r~n' &
+ 'rtnMACAddresses = MACAddressList~r~n' &
+ 'End Function')
ls_message = ole_wsh.Eval("rtnMACAddresses")
ole_wsh.DisconnectObject()
DESTROY ole_wsh
MessageBox("MAC Adress List",ls_message)
mail_outline
Send comment, question or suggestion to howto@rgagnon.com
Send comment, question or suggestion to howto@rgagnon.com