10 Netsh commands of Windows Server 2008 should know

Introducing 10 Netsh commands that every administrator should know. Netsh is very powerful and flexible, however, because it is not possible to select Netsh 'most important' commands, since the importance of each command depends on administrative tasks in each specific task. So what we introduced in this article is 10 commands that we feel are valuable for you and help you when you encounter problems.

Network Administration - Netsh is very powerful and flexible, however, because it is not possible to select Netsh 'most important' commands, because the importance of each command depends on administrative tasks in each specific task. So what we introduced in this article is 10 commands that we feel are valuable for you and help you when you encounter problems. You should note that these commands can be coded (because they are all command line tools), so anything you can do with a certain command on a computer You can also write a script to execute that command on all computers on the network.

  1. Summary of the common Run CMD commands
  2. 13 important SQL statements Programmer needs to know

What is Netsh?

Microsoft Windows Netsh is a command line script utility. With Netsh, you can view or change the network configuration of your local computer or remote computer. You can run Netsh commands manually or you can create block files or scripts to automate the process. Not only can you run these commands on your local computer, but you can also run it on remote computers on the network.

Netsh also provides a scripting feature and can allow you to run a group of commands in block mode for a specific computer. With netsh, you can also save a text-based configuration script for different purposes or you can configure other computers.

Netsh is not new to Windows Server 2008 or Windows Vista. It has been known for a long time. Its commands appear in both Windows 2000, XP and Windows Server 2003. What's new here is some options for Netsh for Windows Server 2008 and Vista.

Differences of netsh between Windows Server 2008 and Windows XP

There are some differences in the 'core' command level between the Windows XP version of netsh and the Windows Server 2008 version. For comparison, we have run ' netsh /? 'in each operating system. For Windows XP there is a 'route' listed as a context and Windows Server 2008 is not, that is the context that Win 2008 lacks (and that is grouped in the context of 2008 RAS). In contrast, Windows Server 2008 has the following context options that Windows XP does not have:

  1. dhcp
  2. dhcpclient
  3. http
  4. ipsec
  5. spread
  6. nap
  7. netio
  8. rpc
  9. winhttp

As you can see, there are more 'contextual' options available in Window Server 2008.

To avoid rambling, we will go into 10 Netsh commands that every administrator should know about.

# 10 - Looking for help

Every Windows administrator needs to know the help for netsh. This is really easy - just use the '/?' Command, you will get instructions on what you are trying to do. For example, to display all the contexts of netsh (items of options), just type: netsh /?

10 Netsh commands of Windows Server 2008 should know Picture 110 Netsh commands of Windows Server 2008 should know Picture 1
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:

10 Netsh commands of Windows Server 2008 should know Picture 210 Netsh commands of Windows Server 2008 should know Picture 2
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

10 Netsh commands of Windows Server 2008 should know Picture 310 Netsh commands of Windows Server 2008 should know Picture 3
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:

  1. dhcp
  2. dhcpclient
  3. http
  4. ipsec
  5. spread
  6. nap
  7. netio
  8. rpc
  9. winhttp

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:

  1. Reset all IP protocol stack configurations on your interface and send the output to a log file - netsh int ipv4 reset resetlog.txt

  2. Install TCP / IP - netsh int ipv4 install

  3. Remove the TCP / IP protocol - netsh int ipv4 uninstall

# 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:

  1. Show all firewall rules - netsh advfirewall firewall show rule name = all

  2. Delete the firewall rule sent to port 21 - netsh advfirewall firewall delete name rule name = all protocol = tcp localport = 21

  3. Export Windows settings Advanced Firewall - netsh advfirewall export 'c: advfirewall.wfw'

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:

  1. Connect to an unspecified network - netsh wlan connect ssid = 'mySSID' name = 'WLAN-Profil1'

  2. Show netsh current settings - netsh wlan show settings

  3. Add an exported wireless network profile - netsh wlan add profile filename = "Wireless Network Connection-BOW.xml"

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:

  1. Show IP address - netsh interface ip show config

  2. Set up an interface to use DHCP to configure its IP address - netsh interface ip set address name = "Local Area Connection" source = dhcp

  3. 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

  4. Add DNS Server - netsh interface ip add dnsserver "Local Area Connection" 10.0.0.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:

  1. Create virtual machines in Hyper-V on Windows Server 2008
  2. 10 tips with PowerShell in Windows Server 2008 - Part 2
  3. Instructions for installing Active Directory on Windows Server 2008
4 ★ | 14 Vote