Beruflich Dokumente
Kultur Dokumente
What is 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.
Syntax
netsh [-a AliasFile] [-c Context] [-r RemoteMachine] [Command | -f ScriptFile]
-a AliasFile Specifies that an alias file is used. An alias file contains both a list of netsh commands and an aliased version of each. You can use the aliased command to shorten a Netsh command. -c Context Specifies the default context for subsequent commands at the Netsh command prompt. Without the -c option, the default context is the root context netsh>. -r RemoteMachine Specifies that the Netsh commands are run against a remote computer, as specified by either its computer name or IP address. Command Specifies the netsh command to run. You must specify a full Netsh command, complete with parameters. Otherwise, Netsh displays command-line help. If the -c option is used, the context is included as part of the Netsh command. -f ScriptFile Specifies that all of the Netsh commands in the ScriptFile file are run. Available commands after you have entered the netsh command (typing netsh at the prompt and pressing enter). Discards changes made while in offline mode. .. Goes up one context level. ? Displays a list of commands. abort add Adds a configuration entry to a list of entries. alias Adds an alias. bye Exits the program. commit Commits changes made while in offline mode. delete Deletes a configuration entry from a list of entries. dump Displays a configuration script. exec Runs a script file. exit Exits the program. help Displays a list of commands. interface Changes to the `interface context. offline Sets the current mode to offline. online Sets the current mode to online. popd Pops a context from the stack. pushd Pushes current context on stack. quit Exits the program. ras Changes to the ras context. routing Changes to the routing context. set Updates configuration settings. show Displays information. unalias Deletes an alias.
View your TCP/IP settings Reset the TCP/IP Stack Delete arp cache Configure your computers IP address and other TCP/IP related settings Import/Export your TCP/IP settings Configure firewall Show network parameters Launch the GUI Network Diagnostic Program
A common use of netsh is to reset the TCP/IP stack to default, knowngood parameters, a task that in Windows 98 required reinstallation of the TCP/IP adapter. In this mode you must provide a log file, which will be filled with what values netsh affected.
Deletes the arp cache entries for all available adapters (including the dial up adapter). Works well with DSL if you are able to ping the loopback address, and your own IP but nothing else.
This command configures the interface named Local Area Connection with the static IP address 192.168.0.20, the subnet mask of 255.255.255.0, and a default gateway of 192.168.0.1 Configure your NIC to automatically obtain an IP address from a DHCP server:
netsh interface ip set address "Local Area Connection" dhcp
Configure DNS:
netsh interface ip set dns "Local Area Connection" static 192.168.0.200
Configure WINS:
Import your IP settings and change them, just enter the following command in a Command Prompt window (CMD.EXE):
netsh -f c:\\MyAnotherSettings.txt
Configure firewall
Enable/Disable Windows firewall
netsh firewall set opmode mode=disable
This will disable the Windows Firewall, we could use the following command to enable it:
netsh firewall set opmode mode=enable
Again if we look at the exceptions list, MyProgram.exe has been added. We can view the firewall configuration by running the following command:
netsh firewall show allowedprogram
Displays the primary and secondary WINS servers for each adapter.