D
Dave R.
In a batch file that uses only standard Windows commands (no third-party
utilities) I need to be able to extract the MAC address of the ethernet
adapter installed in the machines we deploy and display it to the user
in a format like "The MAC Address is: 00-00-00-00-00-00". I'm running
Vista Business Edition with SP1, and I've gotten close with the
following (which worked under XP SP2):
ipconfig /all|find "Physical Address">c:\windows\temp\macaddress.txt
for /f "tokens=2 delims=:" %%i in (c:\windows\temp\macaddress.txt) do
@echo The MAC Address is %%i
The problem is that under Vista, I end up with three MAC addresses
displayed because there are multiple Physical Addresses listed in
IPCONFIG's output (listed below).
How can I limit the display to the Ethernet adapter's MAC address?
IPCONFIG /ALL
Windows IP Configuration
Host Name . . . . . . . . . . . . : XXXXXX
Primary Dns Suffix . . . . . . . :
Node Type . . . . . . . . . . . . : Hybrid
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
DNS Suffix Search List. . . . . . : mycompany.com
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . : mycompany.com
Description . . . . . . . . . . . : Intel(R) 82566DM-2 Gigabit
Network Connection
Physical Address. . . . . . . . . : 00-1A-A0-C3-3C-5D
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . :
fe80::f03c:d8f1:d28b:befc%8(Preferred)
IPv4 Address. . . . . . . . . . . : 192.168.0.111(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Lease Obtained. . . . . . . . . . : Sunday, January 21, 1872 8:57:34
AM
Lease Expires . . . . . . . . . . : Sunday, March 02, 2008 12:25:49
PM
Default Gateway . . . . . . . . . : 192.168.0.1
DHCP Server . . . . . . . . . . . : 192.168.0.1
DNS Servers . . . . . . . . . . . : 192.168.0.1
192.168.0.2
Primary WINS Server . . . . . . . : 192.168.0.1
Secondary WINS Server . . . . . . : 192.168.0.2
NetBIOS over Tcpip. . . . . . . . : Enabled
Tunnel adapter Local Area Connection* 6:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . : mycompany.com
Description . . . . . . . . . . . : isatap.mycompany.com
Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Tunnel adapter Local Area Connection* 7:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Teredo Tunneling Pseudo-Interface
Physical Address. . . . . . . . . : 02-00-54-55-4E-01
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Regards,
Dave
utilities) I need to be able to extract the MAC address of the ethernet
adapter installed in the machines we deploy and display it to the user
in a format like "The MAC Address is: 00-00-00-00-00-00". I'm running
Vista Business Edition with SP1, and I've gotten close with the
following (which worked under XP SP2):
ipconfig /all|find "Physical Address">c:\windows\temp\macaddress.txt
for /f "tokens=2 delims=:" %%i in (c:\windows\temp\macaddress.txt) do
@echo The MAC Address is %%i
The problem is that under Vista, I end up with three MAC addresses
displayed because there are multiple Physical Addresses listed in
IPCONFIG's output (listed below).
How can I limit the display to the Ethernet adapter's MAC address?
IPCONFIG /ALL
Windows IP Configuration
Host Name . . . . . . . . . . . . : XXXXXX
Primary Dns Suffix . . . . . . . :
Node Type . . . . . . . . . . . . : Hybrid
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
DNS Suffix Search List. . . . . . : mycompany.com
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . : mycompany.com
Description . . . . . . . . . . . : Intel(R) 82566DM-2 Gigabit
Network Connection
Physical Address. . . . . . . . . : 00-1A-A0-C3-3C-5D
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . :
fe80::f03c:d8f1:d28b:befc%8(Preferred)
IPv4 Address. . . . . . . . . . . : 192.168.0.111(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Lease Obtained. . . . . . . . . . : Sunday, January 21, 1872 8:57:34
AM
Lease Expires . . . . . . . . . . : Sunday, March 02, 2008 12:25:49
PM
Default Gateway . . . . . . . . . : 192.168.0.1
DHCP Server . . . . . . . . . . . : 192.168.0.1
DNS Servers . . . . . . . . . . . : 192.168.0.1
192.168.0.2
Primary WINS Server . . . . . . . : 192.168.0.1
Secondary WINS Server . . . . . . : 192.168.0.2
NetBIOS over Tcpip. . . . . . . . : Enabled
Tunnel adapter Local Area Connection* 6:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . : mycompany.com
Description . . . . . . . . . . . : isatap.mycompany.com
Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Tunnel adapter Local Area Connection* 7:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Teredo Tunneling Pseudo-Interface
Physical Address. . . . . . . . . : 02-00-54-55-4E-01
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Regards,
Dave