MAC address
Moderators: JRL, Dorian (MJT support)
MAC address
Is there a way to get the MAC address of a network card in MS ? I would like to simply get it and reference it in a txt file?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
The following returns all MAC addresses and associated IP addresses. It returns all for the local machine.
Code: Select all
VBSTART
Function GetMacAddresses
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery ("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
Result = ""
For Each objItem in colItems
Result = Result & objItem.MACAddress & ":"
For Each strAddress in objItem.IPAddress
Result = Result & strAddress & ","
Next
Result = Result & vbCRLF
Next
GetMacAddresses = Result
End Function
VBEND
VBEval>GetMacAddresses,macAddresses
MessageModal>macAddresses
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?