Use Netsh to manage remote servers and workstations

Source: Internet
Author: User

Use Netsh to manage remote servers and workstations

Windows Network shell Netsh) may be a good way to view or manage network-related devices through a command prompt. You can use it to run one-time commands, or use scripts to automate them. As we will discuss today, Netsh can also be used to manage remote workstations and servers.

Use Netsh remote functions

Netsh's built-in remote function allows you to send commands to machines on the network. You can specify the remote machine on which you want to run commands or scripts, as long as the-r option is inserted. If necessary, you can also specify the logon certificate used for the remote connection:-u indicates the User Name of the remote machine, and-p indicates the password.

Open the command prompt and enter the following command to access the Netsh CLI command line interface on the remote machine ):

 
 
  1. netsh -r hostname -u domain\admin -p password

Once you confirm that you can obtain remote access, you can directly run the netsh command. For example, this command shows how to obtain IP Configuration:

 
 
  1. netsh -r hostname -u domain\admin -p password interface ip show config 

In addition to the Host Name of the remote machine, you can also use the IP address or FQDN.

If you encounter problems when connecting to a Remote machine, make sure that the Remote Registry) service runs on the Remote machine. If it is Not running, Windows may display the "Network Path Not Found" Network Path Not Found) error message. In addition, make sure that File and Printer Sharing for Microsoft Networks files and printers are shared on the Microsoft Network. Make sure that no firewall blocks traffic as usual.

If the connection problem persists, try the following method to edit the registry:

1. Open RegEdit on the remote machine and browse to HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Policies \ System.

2. Add a new DWORD Value named "LocalAccountTokenFilterPolicy". If the value does not exist before, make sure that it is set to "1 ".

3. Restart the remote machine.

Use Netsh through ipvxec

Netsh lacks a simple method to manage multiple remote machines at the same time. Although you can use the built-in remote functions, such as putting Multiple Remote addresses together into batch files and other scripts, it may be better to use other options.

For example, using the javasxec utility http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx from the Windows Sysinternals website), you can distribute Netsh or any other command to multiple machines at the same time.

Once you download javasxec, open the command prompt, enter the folder containing it, and try the following command to access the CLI of the remote machine:

 
 
  1. psexec \\hostname -u domain\admin -p password cmd 

If the operating system installed on the remote machine is Windows Vista or later, you may need to use the-h option to allow the process to run with the account escalation token elevated token.

Once you confirm that you can obtain remote access, you can directly run the netsh command, for example:

 
 
  1. psexec \\hostname -u domain\admin -p password cmd.exe /c netsh.exe interface ip show config 

If you do not need interactive CLI-for example, if you are running a command that does not provide output, you can consider adding the-d option for javasxec. This option indicates that it does not wait for the process to end. On the other hand, if you want to make the program interactive on the desktop of a remote machine, you can consider using the-I option.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.