netsh
Netsh is a command-line scripting utility that allows you to, either locally or remotely, display or modify the network configuration of a computer that is currently running. Netsh also provides a scripting feature that allows you to run a group of commands in batch mode against a specified computer. Netsh can also save a configuration script in a text file for archival purposes or to help you configure other servers. [1]
>netsh /?
|
How about we start off with controlling the firewall? Let’s look at the syntax of the netsh command in this case;
netsh firewall set portopening protocol = [TCP|UDP] port = <Number> name = <New Port Name> interface = ”>Interface Name<
|
If we need to open the Windows firewall to TCP traffic on port 445 for Windows 2000+ SMB over TCP/IP
netsh firewall set portopening TCP 445 ENABLE
|
or our new corporate antivirus server 192.168.0.10 needs access on :666 …
netsh firewall add portopening TCP 666 Anti-Virus ENABLE CUSTOM 192.168.0.66
|
Want a quick dump of your firewall config?
netsh firewall show config
|
Set the LAN connection to DHCP …
netsh interface ip set address "Local Area Connection" dhcp
|
Also checkout WMIC, tasklist and taskkill tools
>wmic /?
|
tasklist
|
taskkill
>taskkill /?
|
[1.] Using Netsh [MS]
[2.] Command line kung-fu 24-Aug-2006 [SANS]
[3.] Windows Command-Line Kung Fu with WMIC 30-Mar-2006 [SANS]
[4.] Netsh Command (Certification) [Lockergnome]
[5.] How to Use the Netsh.exe Tool and Command-Line Switches [MS]
[6.] How to Use the NETSH Command to Change from Static IP Address to DHCP in Windows 2000 [MS]
[7.] Using Netsh with Windows Firewall [WindowsNetworking]









