Gain MAC address by batch file
Posted: 30 Dec 2013 19:37
Hi all,
I have a query and need your help, geniuses.
I'm a junior helpdesk in our company, and I have to record all the machines's name & MAC address when I prepare them. To be relaxable, I want to get the information by a script. Now the problem is: there are more than one network adapters, including the virtual adapter. I use below script:
Owing to the multiple adapter, I only can show the line number, and filter the correct one manually. Now my requirement is, how can I only record the appropriate physical address? It's usually the first one.
Thank you in advance and wish a good New Year.
I have a query and need your help, geniuses.
I'm a junior helpdesk in our company, and I have to record all the machines's name & MAC address when I prepare them. To be relaxable, I want to get the information by a script. Now the problem is: there are more than one network adapters, including the virtual adapter. I use below script:
@echo off
echo %date% %time% >>\\fileserver\MACList.txt
echo ============================ >>\\fileserver\MACList.txt
ipconfig /all | find /i "host name" >>\\fileserver\MACList.txt
ipconfig /all | find /n /i "physical address" >>\\fileserver\MACList.txt
echo ============================ >>\\fileserver\MACList.txt
echo. >>\\fileserver\MACList.txt
Owing to the multiple adapter, I only can show the line number, and filter the correct one manually. Now my requirement is, how can I only record the appropriate physical address? It's usually the first one.
Thank you in advance and wish a good New Year.