netsh: Administrators friend

Resetting the TCP/IP Stack

For XP/2003
Go to start > Run > type “cmd” press enter > then type the following:

netsh int ip reset resetlog.txt

For Vista
Go to start > Run > type “cmd” press enter > then type the following:

netsh int ip reset
netsh winsock reset


Adding and removing ports

For XP/2003
at the command prompt

netsh firewall add portopening TCP 5900 VNC5900

or

netsh firewall add portopening UDP 33422 info

The command break-down:
netsh firewall < this means that we are messing with the firewall
add poropening < this means we are adding a port
UPD/TCP < here we need to specify what type of port we are opening
33422 < here we type in the port number
info < windows needs some label for the opened port, you can type just about anything here. Best keep it informative.

For Vista/2008

netsh advfirewall firewall add rule name=”info” dir=in action=allow protocol=UDP localport=33422

Vista/2008, different command, but it’s clear where you need to change the settings.

To delete/remove the port replace the “add” with “delete”, example:

XP/2003

netsh firewall delete portopening protocol=UDP port=33422

Vista/2008

netsh advfirewall firewall delete rule name=info protocol=udp localport=33422

You can also make a bat script adding all the ports you want closed or open, just list the commands and save as a bat.

DHCP or Static IP via command line

Set DHCP address – replace “Local Area Connection” with the name of the adapter you want to configure.

netsh interface ip set address "Local Area Connection" dhcp

then

netsh interface ip set dns “Local Area Connection” dhcp

Set a Static IP address

netsh interface ip set address "Local Area Connection"  static 192.168.0.4 255.255.255.0 192.168.0.1 1

then

netsh interface ip set dns name=”Local Area Connection” static 192.168.0.1

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>