Source Code to Obtaining MAC Address Information

Here is a way that can be used when you want to get information about existing MAC Address Network Card in a PC or Laptop. 

A media access control address (MAC address) is a unique identifier assigned to network interfaces for communications on the physical network segment. MAC addresses are used as a network address for most IEEE 802 network technologies, including Ethernet and WiFi. Logically, MAC addresses are used in the media access control protocol sublayer of the OSI reference model.

MAC addresses are most often assigned by the manufacturer of a network interface controller (NIC) and are stored in its hardware, such as the card's read-only memory or some other firmware mechanism. If assigned by the manufacturer, a MAC address usually encodes the manufacturer's registered identification number and may be referred to as the burned-in address (BIA). It may also be known as an Ethernet hardware address (EHA), hardware address or physical address. This can be contrasted to a programmed address, where the host device issues commands to the NIC to use an arbitrary address.


If you want to try to get the MAC address data in the PC or laptop via the source code , can use the following syntax : 

cMacAddress=""
objWMIService = GetObject("winmgmts:"+;
 "{impersonationLevel=impersonate}!\\.\root\cimv2")
colItems = objWMIService.ExecQuery(;
 "Select * From Win32_NetworkAdapterConfiguration")
For Each objItem in colItems
 IF varTYPE(objItem.MACAddress)="C"
  cMacAddress=cMacAddress+objItem.MACAddress+","
  endif
endfor
?cMacAddress

After running the syntax above, the MAC address information stored in the variable cMacAddress . Some PC or Laptop will probably have more than one MAC address, depending on the number Network Card installed . If there is more than one MAC Address in variable cMacAddress it will also contain more than one MAC addresses that are separated by a comma (,) 

0 Response to "Source Code to Obtaining MAC Address Information"

Post a Comment

wdcfawqafwef