Figure 1: The screen shows the command's help options '/?'
From here, you can choose a context and be guided through the configuration or presentation of options in that context. For example, type in netsh lan /? , we shall see:
Figure 2: Results of the netsh lan / command?
We can continue with the help by
netsh lan show /?
we will see the interface with
netsh lan show interfaces
Can you guide yourself through many netsh commands using /? is a very valuable skill.
# 9 - Provide remote computer names and certificates
If running netsh /? You will find that you can provide the remote computer's name and IP address and certificates for it. The '-r' option for the machine, '-u' for the username and '-p' for the password. Here is an example:
netsh -r WinXP-1 -u winxp-1 My administrator-pass! pass1 interface ip show config
As you can see, we provided the name for a remote machine, the remote username and password allowed me to execute this command on the network. You can execute any command displayed here on your network as long as the remote computer supports that command (different operating systems will use different commands in the commands).
# 8 - Run Netsh in interactive mode or with a script
Netsh can be run in interactive mode (manually typing commands) or when using scripts. If you want to execute some of these commands on your local computer or remote computer. You can then start by typing netsh at the command line and you will see:
netsh>
Here you can enter all the netsh commands you want, or even tell netsh to connect to a remote computer with the setup machine.
In other words, you can use netsh –f and specify the script that netsh will use.
# 7 - Open the port on the firewall
With netsh, you can quickly and easily open a port on the firewall if you know the right command. Here is an example of opening port 445-
netsh firewall set portopening tcp 445 smb enable
If this command succeeds, you will see an 'Ok' response.
# 6 - Export the current network configuration to a file and import it
With netsh, it's easy to export and import your IP address configuration - unlike in the GUI interface. To export your configuration, just type:
netsh –c interface dump> test.txt
Figure 3: Export configuration IP address and file view
On another machine, you can import this configuration with netsh –f test.txt
# 5 - Check out the new Netsh utility capabilities
As mentioned above, there are many new features in Windows Server 2008 when included with netsh.
Here are some of the new items we saw in our Windows Server 2008 system:
For example, you can not only configure DHCP clients but also DHCP servers. Can configure IPSec encryption, NAP client and, .!
Because you can add roles and features to your server, you will have additional contexts. For example, if you add a network policy server to Windows Server 2008, you will have 'nps' as a netsh context and this context can be configured.
# 4 - TCP / IP troubleshooting and interface reset
There are several things you can do with netsh to troubleshoot and reset the TCP / IP network interface. Here are some examples:
Reset all IP protocol stack configurations on your interface and send the output to a log file - netsh int ipv4 reset resetlog.txt
Install TCP / IP - netsh int ipv4 install
# 3 - Configure Windows firewall
In the previous article, Configuring advanced firewall in Windows 2008 using NETSH CLI, we showed you how to configure Windows firewall by using network context settings by netsh in Windows Server 2008 and Windows Vista. Obviously, you can also configure the traditional Windows firewall. Here are some examples:
Show all firewall rules - netsh advfirewall firewall show rule name = all
Delete the firewall rule sent to port 21 - netsh advfirewall firewall delete name rule name = all protocol = tcp localport = 21
Perhaps the most commonly used command you can use is the command to enable or disable the Windows firewall, like this:
netsh firewall set opmode disable
or
netsh firewall set opmode enable
However, for more details and examples, see the article in the article.
# 2 - Configure wireless settings
In a previously introduced article, Configure wireless connection of Windows Vista from the CLI using netsh wlan, we showed you how to configure wireless network settings with netsh in Windows Server 2008 and Windows Vista. Here are some examples:
Connect to an unspecified network - netsh wlan connect ssid = 'mySSID' name = 'WLAN-Profil1'
Show netsh current settings - netsh wlan show settings
However, for more specific information, see the article above.
# 1 - Configure network interface settings and IP addresses
Netsh is a 'network shell', is there a better way to use it to configure basic network settings? Here are some examples:
Show IP address - netsh interface ip show config
Set up an interface to use DHCP to configure its IP address - netsh interface ip set address name = "Local Area Connection" source = dhcp
Set up an interface to use a static IP address to configure its IP address - netsh interface ip set address "Local Area connection" static 10.0.0.9 255.0.0.0 10.0.0.1 1
Conclude
The netsh command line utility is always a very powerful tool for Windows administrators. With the new features added in Windows Server 2008 and Windows Vista, netsh becomes a much more powerful utility. In this article, you have seen how strong that power has been and we have provided 10 useful commands for netsh.
Author: David Davis
See more: