Automate Network Adapter Configuration using NETSH
Automate Network Adapter Configuration using NETSH

Enter the NETSH commands. The NETSH command can be used to modify the network configuration on Windows 2000 and later computers. It's not the friendliest syntax to use but it is a real time saver once you learn to use it. Listed below are sample script for using NETSH to set STATIC IP entries on an adapter and another script to set the adapter back to DHCP mode so the settings can be obtained automatically. The command syntax for Vista and XP are slight different due to the fact that Vista supports IPV6 natively so sample scripts for each OS are listed below. To use the code, paste it into a batch file and modify the "name=" to the name of the adapter in quotes and change the IP addresses.

VISTA - Static IP

  • netsh interface ipv4 set address name="Wireless Network Connection 2" source=static addr=192.168.0.100 mask=255.255.255.0 gateway=192.168.0.250 gwmetric=0
  • netsh interface ipv4 set dnsserver name="Wireless Network Connection 2" source=static addr=192.168.0.2 register=NONE
  • REM netsh interface ipv4 set wins name="Wireless Network Connection 2" source=static addr=155.217.27.9
  • REM OR if no WINS server
  • netsh interface ipv4 set winsserver name="Wireless Network Connection 2" source=dhcp
  • ipconfig /all

VISTA - DHCP

  • netsh interface ipv4 set address name="Wireless Network Connection 2" source=dhcp
  • netsh interface ipv4 set dnsserver name="Wireless Network Connection 2" source=dhcp
  • netsh interface ipv4 set winsserver name="Wireless Network Connection 2" source=dhcp
  • ipconfig /renew "Wireless Network Connection 2"
  • ipconfig /all

XP - Static IP

  • netsh interface ip set address name="BROADCOM" source=static addr=192.168.27.40 mask=255.255.255.224
  • netsh interface ip set address name="BROADCOM" gateway=192.168.27.33 gwmetric=0
  • netsh interface ip set dns name="BROADCOM" source=static addr=192.168.98.12 register=NONE
  • netsh interface ip set wins name="BROADCOM" source=static addr=none

XP - DHCP

  • netsh interface ip set address name="BROADCOM" dhcp
  • netsh interface ip set dns name="BROADCOM source = dhcp
  • netsh interface ip set wins name="BROADCOM" source=dhcp


___________________

"The important thing is not to stop questioning. Curiosity has its own reason for existing."
Windows Support / Core Member


ok to chief... will this help even in GUI block mo config ng tcp/ip? and need ba nya na admin ka nakalog or user will do?

thanks chief




FREE cPanel Web Hosting with PHP5/Mysql - no advertising!
Register now: http://www.000webhost.com/39629.html