If you want to execute a command on
a remote windows system, you can use the psexec utility (https://technet.microsoft.com/en-us/sysinternals/bb897553.aspx).
Download PsTools.zip, unzip it on your local hard drive and run the psexec.exe
utility by using the following general syntax:
psexec
\\computer-name command
Examples
Let's say that the remote machine is named test-pc. You can:
1) Get its ip configuration: psexec \\test-pc ipconfig
2) Get its shared network resources: psexec \\test-pc net view
3) Execute a program that resides on the remote system's local
drive: psexec \\test-pc "C:\test\test.exe"
5) Issue any command as you would do on the local computer.
Issues
When a remote command fails to execute you can think of the
following possible solutions:
1) Remember that you should have an account with the same credentials (username and password) on the remote
machine.
2) Check the command's
syntax. Keep in mind that paths with spaces should be enclosed in
"".
3) Make sure that you have enabled
the default ADMIN$ share on
the remote machine.
4) Consider the possible
security issues. For example, lets say that you want to change the default
gateway of the remote system to 192.168.1.1. You'll need administrator
privileges to do this. The psxec utility allows you to specify the username and
password with which you want to execute the remote command. So, in this case
you should type: psexec
\\test-pc -u username -p passwd route change 0.0.0.0 mask 255.255.255.0
192.168.1.1
5) Even if you are an administrator on the remote machine
the UAC (User Account Control) may block the command
execution.Theoritically, the psexec allows you to bypass the UAC prompt by
using the -h option, but in my case (Windows 8.1),
this does not always work.
For more details, you should study the full documentation of
psexec.