When all computers are turned on, count the IP addresses obtained now. When copying, write down two things, the computer number and the last digit of the IP address. After the inventory is completed, use a LAN scanning software to scan all the machines in the network segment, then run cmd, and then use ARP-A command to obtain the current IP addresses and MAC addresses of all computers.
The second step is planning.
Make a five-column excel table, first paste the IP address and MAC address obtained by ARP-A command. When copying in the cmd command window, remember to copy the IP and paste it into one column, then copy the MAC address and paste it into another column. Don't copy IP and MAC together, so that the pasted IP and MAC are in one cell, and then enter the computer name planned by this computer.
? The third step is batch processing.
? Finish this form and make a batch directly. The code is as follows:
@ Turn off echo
Echo is configuring IP address and DNS. please wait ...
Set mask =255.255.255.0
Set gateway =192.168.103.254.
Set DNS1= 202.96.128.143.
Set DNS2=202.96. 128.68.
Set wins =192.168.103.254.
For/f "tokens =12 delims ="% ii in ('ipconfig/all | find/i "physical address"') doset MAC =%% i.
For /f "tokens= 1, 2 * "%ii in ('ipconfig/all | find" Ethernet adapter "')? Do set Ethernet =%%k
for /f "tokens= 1,2 " % % I in(' more/e+2 1% 0 ^|find/I " % MAC:~,- 1% " ')do set " name = % % I " & amp; Set "IP=%%j"
for/f " tokens = 4 " % % j in(' more/e+2 1% 0 ^|find/I " % MAC:~,- 1%"') do set "p=%%j "
reg add " HKEY _ LOCAL _ MACHINE \ SYSTEM \ control set 00 1 \ Services \ lanman server \ parameters "/v SRV comment/t reg _ SZ/d % p %/f & gt; Nul 2> is empty
reg add " HKEY _ LOCAL _ MACHINE \ SYSTEM \ current control set \ Services \ lanman server \ parameters "/v SRV comment/t reg _ SZ/d % p %/f & gt; Nul 2> is empty
reg add " HKEY _ LOCAL _ MACHINE \ System \ current Control set \ Control \ computer name \ computer name "/v computer name/t reg _ SZ/d % name %/f & gt; Nul 2> is empty
reg add " HKEY _ LOCAL _ MACHINE \ System \ current control set \ Services \ Tcpip \ Parameters "/v " NV Hostname "/t reg _ SZ/d % name %/f & gt; Nul 2> is empty
reg add " HKEY _ LOCAL _ MACHINE \ System \ current control set \ Services \ Tcpip \ Parameters "/v Hostname/t reg _ SZ/d % name %/f & gt; Nul 2> is empty
Netsh interface ip set address "%Ethernet: ~, -2%" static% IP%% mask%% gateway%1> Nul 2> is empty
Netsh interface ip set DNS "%Ethernet: ~,-2%" static% DNS1%register = primary > Nul 2> is empty
Add DNS "%Ethernet: ~, -2%" to netsh interface ip? % DNS2% index = 2 & gtnul 2> empty.
Netsh interface ip set wins "%Ethernet: ~, -2%" static %WINS%? & gtnul 2> is empty.
export
A 0 1192.168.1kloc-0/160-4b-77-Fe-A01
A02192.168.103.10210-60-4b-8b-50-bea02 on the north third floor.
A03192.168.103.103/kloc-0-60-4b-88-61-7A03.
A04192.168.103.104160-4b-88-70-a6a04.
North third floor A05192.168.103.105160-4b-89-46-cea05.
A06192.168.103.106160-4b-8b-51-3fa06 north third floor.
North third floor A07192.168.103.10710-60-4b-8b-53-cda07.
A08192.168.103.10810-60-4b-8b-51-38a08.
A09192.168.103.109160-4b-77-E5-c4a09 north third floor.
A 10192.168.103.1010-60-4 b-77-ea-C2 north third floor.
B 0 1192.168.103.1/kloc-0-60-4b-77-E7-E6, north third floor B0/.
B02192.168.103.1210-60-4b-77-Fe-80b02.
B03192.168.103.1310-60-4b-88-5e-b03 on the third floor of CC North.
North third floor B04192.168.103.1410-60-4B-77-EA-A9B04
North third floor B05192.168.103.1510-60-4B-77-Fe-9B05
North third floor B06192.168.103.1610-60-4B-77-E7-EBB06.
B07192.168.103.17160-4b-88-70-a1b07.
B08192.168.103.1810-60-4b-8b-50-99b08.
B09192.168.103.19160-4b-86-2f-D2 B09, north third floor.
B 10192.168.103.12010-60-4b-77-Fe-F4, North Third Floor B1.