How to run a program on a remote PC via command line?
99,744
Solution 1
I think you're looking for PsExec
This is what you'd do to execute a CLI program on a remote computer using PsExec:
psexec \\REMOTECOMPUTER "path_to_program_executable"
You can learn more about PsExec and its various options along with some examples here
Solution 2
On more option is the built in winrs
winrs.exe -r:<RemoteComputerName> <TheCommandToRun>
winrs.exe -r:MyRemoteServer ipconfig
winrs vs. psexec
advantages winrs
- Built in, no download needed
- Faster and more reliable than psexec
advantages psexec
- Works with IP (winrs needs the computername (NetBIOS name) of the machine)
- Can run processes in system-context
Related videos on Youtube
Comments
-
arc_lupus almost 2 years
How can I run a program on a remote Windows PC in our network without the need of killing an existing remote-desktop-connection? I only need a command line for running the program and getting its results.
-
Royi over 6 yearsHow can I run something on Google VM (Windows)? But I mean that it will launch a GUI. Namely if I log on (RDP) I will see the program running on the desktop.
-
Vinayak over 6 years@Royi try
psexec -i -d -s \\remotecomputer command
. Please read the docs as well if you run into issues. -
Royi over 6 yearsCan
\\remotecomputer
be an IP? -
Vinayak over 6 years@Royi Yes, \\ipaddress