The netsh command has been released for a long time, with Netsh commands in Windows 2000/XP/2003. Windows Server 2008 just made some extensions to the netsh parameter items. In daily work, many administrators don't know much about netsh, and they don't even know what features netsh enhances in Windows Server 2008. By reading this article, Windows administrators can find answers to the questions listed above.
First, what is Netsh?
Microsoft Windows Netsh is a command line script utility. Use the netsh tool to view or change the network configuration of your local or remote computer.
Not only can these commands be run on the local computer, but they can also be run on remote computers on the network.
You can manually run Netsh commands or create batch files or scripts to automate the process. Netsh provides scripting capabilities that let you run a set of commands for a given computer in batch mode. With netsh, you can save configuration scripts as text files for archiving or for configuring other computers.
Second, Windows Server 2008 netsh and Windows XP netsh comparison
Even at the core command level, there are some differences between the Windows XP version of netsh and Windows Server 2008 netsh. To compare these, we can run "netsh /?" on each operating system. Although Windows XP has more "routing" options than Windows Server 2008, Windows Server 2008 has more content than the netsh option under Windows XP, as follows:
* dhcp
* dhcpclient
* http
* ipsec
* lan
* nap
* netio
* rpc
* winhttp
From the list above, you can see that there are more options in Windows Server 2008.
Third, the netsh ten commands commonly used by administrators
Next, let us introduce some netsh commands commonly used by system administrators.
#10 – How to get help information
Every Windows administrator should know how to get help from netsh. This is actually very easy - just use the "/?" option. For example, to display all netsh content (option categories), just type netsh/?, as shown in Figure 1:
*** Figure 1: netsh /? help options Execution Results
In the above figure, you can select a context and guide the next step through the configuration items in the context. For example, enter netsh lan/?, you can see the interface shown in Figure 2:
*** Figure 2: Execution results of netsh lan /?
From the information displayed above, you can continue to guide us to continue:
netsh lan show /?
From the return information, we can know that to display the network card information, you can use the following command: Br>
netsh lan show interfaces
By using the netsh command with /? multiple times, you can boot many netsh commands and finally achieve our operational goals.
#9 – Support for remote computer name and login credentials
The execution parameters of the netsh command support remote computer name, IP address and password credentials. The option "-r" indicates the machine name, "-U" indicates the user name, and "-p" indicates the password.
Let's look at an example:
netsh -r WinXP-1 -u winxp-1\\administrator -p My!Pass1 interface ip show config
This example provides The name of the remote computer, the remote username and password, to execute commands remotely over the network. As long as the remote computer supports this command (different operating systems will use a variety of different commands), it can be executed.
#8 - Running in interactive mode or in script mode
The netsh command can be run interactively, manually by entering commands, or in scripts. If you want to manually enter the command step by step on the local machine or remote machine, you can see the following interface by typing netsh in the command line:
netsh>
in netsh> Under the symbol, you can enter all the netsh commands you want to call, and even tell netsh to connect to the remote computer.
On the other hand, you can use netsh -f to specify the script name used by netsh.
#7 – Opening the Firewall Port
The netsh command opens a firewall port quickly and easily. For example, the following example will open port 445:
netsh firewall set portopening tcp 445 smb enable
If the command is executed successfully, it will get a response message of “Ok.”.
#6 – Import and Export of Current Network Configurations
The netsh command makes it easy to import and export your IP address configuration. Unlike the GUI interface, if you want to export configuration information, you need to enter the following command:
netsh –c interface dump > test.txt
** * Figure 3: Export and view configuration information for IP addresses
Later on the same computer or on a different machine, you can import this configuration file using the following command:
netsh –f Test.txt
#5 – Try the latest usage of the Netsh command
Many new features in Windows Server 2008 involve the netsh command. The following is a new category of netsh commands in Windows Server 2008:
* dhcp
* dhcpclient
* http
* ipsec
* lan
* nap
* netio
* rpc
* winhttp
We can not only set up the DHCP client, but also A DHCP server can be set up. You can also configure IPSec encryption, Network Access Protection (NAP) clients, etc...
When you add some roles to the server, you will see more context. For example, if you add a network policy server role to Windows Server 2008, the context of the netsh configuration item will be "nps".
#4 – TCP/IP Troubleshooting and NIC Repair
With netsh, you can troubleshoot and reset TCP/IP NICs. Let's look at the following examples:
* Reset the configuration information of all IP stacks and output the log file - netsh int ipv4 reset resetlog.txt
* Install TCP /IP protocol - Netsh int ipv4 install
* Uninstall TCP /IP - netsh int ipv4 uninstall
#3 - Configure windows advanced firewall
In Windows Server 2008 and Windows Vista, You can configure a two-way Windows Advanced Firewall with the new advfirewall network settings. Of course, you can also set it as a traditional Windows firewall. Here are some examples:
* Show all firewall rules - netsh advfirewall firewall show rule name=all
* Delete all advanced firewall rules associated with port 21 - netsh advfirewall firewall delete Name rule name=all protocol=tcp localport=21
* Export Windows advanced firewall settings - netsh advfirewall export "c:\\advfirewall.wfw"
Perhaps the most frequently used command is To enable or disable the Windows Firewall, you can use the following command:
netsh firewall set opmode disable or:
netsh firewall set opmode enable
#2 – Configure Wireless Settings
In Windows Server 2008 and Windows Vista, you can use the netsh wlan command to configure the configuration file of the wireless network and connect to the wireless network. Let's look at a few examples:
* Connect to a defined wireless network - netsh wlan connect ssid=”mySSID” name=”WLAN-Profil1”
* View current Wireless settings - netsh wlan show settings
* Add a wireless network configuration file - netsh wlan add pro #1 – Configuring IP Address and Network Settings Just like the netsh acronym (network shell), the original purpose of netsh is to configure the basic parameters of the network. Let's look at some examples: * View the IP address of the network card - netsh interface ip show config * Set the IP address of the network card to use DHCP - netsh interface ip set address name="Local Area Connection" source=dhcp * Set the IP address of the NIC to use a static IP address - netsh interface ip set address "Local Area connection" static 10.0.0.9 255.0.0.0 10.0.0.1 1 * Increase DNS server settings - netsh interface ip add dnsserver "Local Area Connection" 10.0.0.1 IV. Summary The netsh command line utility has always been a feature of Windows system administrators. Powerful tools. In Windows Server 2008 and Windows Vista, with the addition of new features, netsh's features will be more powerful and flexible. The 10 commands described in this article should be helpful for administrators in the daily work.
Windows system is predecessor of the DOS operating system, the users operation of the computer must
Recently, some netizens asked the author a technical professional question about
Boot speed is a bit slow, it may be a bit more with Windows boot items, ru
Recently, the author has asked such a question in the major IT forums, Baidu know
Don't care! Protect your "command prompt"
Recovery Console Command Input Tips
Teach you to open the command line window as an administrator
Ending system processes with invincible commands
Running multiple commands at the same time in the command prompt
Windows Defender command line parameters explain
How to use the curl command under Windows?
Make the command prompt more intimate
IP address simplification usage of the ping command
Windows7 system troubleshooting: repair win+e key combination
Which system is better for Win8 and Win7? Win8/7 performance comprehensive index comparison
Windows XP right click on "My Computer" does not show the solution for system properties
How does the Win10 system process take up too much CPU?
Ghost system Windows10 card is not card?
How to make your Windows 7 desktop more beautiful
How to modify QoS to improve network speed under WinXP
Advice for learning - seven tips for learning Linux
Reinstalling Win7 system black screen prompt error code oxc000007b fault analysis and solution