How to execute a Windows command on a remote PC?
Is it possible to execute a Windows shell command on a remote PC when I know its login name and password? Is it possible to do it using client PC's Windows shell?
Solution 1:
If you are in a domain environment, you can also use:
winrs -r:PCNAME cmd
This will open a remote command shell.
Solution 2:
psexec \\RemoteComputer cmd.exe
or use ssh or TeamViewer or RemoteDesktop!
Solution 3:
This can be done by using PsExec
which can be downloaded here
psexec \\computer_name -u username -p password ipconfig
If this isn't working try doing this :-
- Open RegEdit on your remote server.
Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System.
Add a new DWORD value called LocalAccountTokenFilterPolicy
- Set its value to 1.
- Reboot your remote server.
- Try running PSExec again from your local server.
Solution 4:
You can use native win command:
WMIC /node:ComputerName process call create “cmd.exe /c start.exe”
The WMIC is part of wbem win folder: C:\Windows\System32\wbem