Every network interface has a MAC address (Media Access Controller) also known as the physical address. This is the actual hardware address that the lowest level of the network uses to communicate.
The MAC address is used to assign the TCP/IP address by means of DHCP (Dynamic Host Configuration Protcol). For that reason, we need the MAC address of a machine so that it can be properly, and easily configured for the network.
You can enter ipconfig/all in cmd prompt and find Physical address i.e MAC address
vb code Try :
Sub MAC()
Dim strCom As String
Dim objWMIService As Object
Dim colAdapters As Object
Dim objAdapter As Object
strCom = "."
Set objWMIService = GetObject _
("winmgmts:" & "!\\" & strCom & "\root\cimv2")
Set colAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = True")
For Each objAdapter In colAdapters
MsgBox "Physical address : " & objAdapter.MACAddress
Next objAdapter
End Sub
The MAC address is used to assign the TCP/IP address by means of DHCP (Dynamic Host Configuration Protcol). For that reason, we need the MAC address of a machine so that it can be properly, and easily configured for the network.
You can enter ipconfig/all in cmd prompt and find Physical address i.e MAC address
vb code Try :
Sub MAC()
Dim strCom As String
Dim objWMIService As Object
Dim colAdapters As Object
Dim objAdapter As Object
strCom = "."
Set objWMIService = GetObject _
("winmgmts:" & "!\\" & strCom & "\root\cimv2")
Set colAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = True")
For Each objAdapter In colAdapters
MsgBox "Physical address : " & objAdapter.MACAddress
Next objAdapter
End Sub
how can I convert this to a string variable- CTYPE does not work for me
ReplyDeleteerrolw@xpertus.com