Thaiadmin

Script นี้ ไม่ได้ Gateway ช่วยดูให้หน่อยคราบ

0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้

@echo off
@echo Windows 7 , 8

for /f "tokens=1-2 delims=:" %%a in ('ipconfig^|find "IPv4 Address"') do set IP=%%b
for /f "tokens=2 delims=:" %%i in ('ipconfig /all ^|find "Physical Address"') do set MAC=%%i

@echo CHECK IP or MAC ADRESS ..
set COMNAME=CLIENT_DISKLESS
set NETMASK=255.255.255.0
set GATEWAY=192.168.100.254

if /i %IP%==192.168.100.1 (
  set COMNAME=COM01
  set GATEWAY=192.168.100.254
)

if /i %IP%==192.168.100.2 (
  set COMNAME=COM02
  set GATEWAY=192.168.100.254
)

if /i %IP%==192.168.100.3 (
  set COMNAME=COM03
  set GATEWAY=192.168.100.254
)

if /i %IP%==192.168.100.4 (
  set COMNAME=COM04
  set GATEWAY=192.168.100.254
)

@echo COMPUTER RENAME ..
reg delete "hklm\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v "Hostname" /f
reg delete "hklm\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v "NV Hostname" /f
reg add "hklm\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName" /v "ComputerName" /d "%COMNAME%" /f
reg add "hklm\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName" /v "ComputerName" /d "%COMNAME%" /f
reg add "hklm\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v "Hostname" /d "%COMNAME%" /f
reg add "hklm\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v "NV Hostname" /d "%COMNAME%" /f

@echo STATIC IP ADDRESS ..
netsh interface ip set address "Local Area Connection" static %IP% %NETMASK% %GATEWAY%
netsh interface ip set dns "Local Area Connection" static 8.8.8.8
netsh interface ip set win "Local Area Connection" static 4.4.4.4

ออฟไลน์ thaiduons

  • ****
  • 178
  • 1
Re: Script นี้ ไม่ได้ Gateway ช่วยดูให้หน่อยคราบ
« ตอบกลับ #1 เมื่อ: 4 มีนาคม 2015, 13:01:18 »
ลืมค่า metric หรือเปล่าครับ