Click to See Complete Forum and Search --> : running an exe on a remote PC
penina
December 11th, 2002, 06:26 AM
Hello,
How do I make an exe start running on a remote PC?
myapp.exe is on PC A and I want from PC B to start run
myapp.exe (that is on PC A) on PC A - how do I do that?
Valen
December 11th, 2002, 03:46 PM
There are many programs available to allow you to remotely control another computer either with or without the remote user knowing. Netbus will do what you are wanting, but a virus scanner will pick it up. If you want to write the software yourself you'll need to write a small winsock server program that will call the ShellExecute API function when you signal it on the remote computer. You'll also need to write a small client program for you to use locally that will transmit the signal.
Ejaz
December 12th, 2002, 12:42 AM
Sounds like either u r writing a monitoring tool or some sort of hacking tool. If u r working to hack then no one can help u here but if u want to develop some sort of survillance system, then first u need to understand the architecture of client and server.
In this case, the architecture is what can be said as "Reverse Client/Server", like u'll have ur multiple servers deployed at different computers and from one computer at which u'll have ur client, will initiate a request, the server at the other side will get the request and will do as it is programmed.
Now the question is how to start the server. If u want to run an .exe after ur server started at remote computer, then its not a big deal, all u have to do is, just program ur server, send the exe from client to server and server will execute it. But now the question is how to start the server. For that, u can use registry.
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
Enter the path of ur server at this location and whenever the computer will start ur .exe will be started as well. Beside that, u can create some service, that serve the purpose.
Download VNC, study its source and will help u alot. I guess the brief explaination will give u some idea.
Regards,
Ejaz.
penina
December 12th, 2002, 01:55 AM
Thank you for your reply,
First of all I don't plan to hack anything.
I programmed a distributed system that has to run on several computers. I wanted to give the user the option to start each exe from one PC. I used to do that with a "deamon" server on each PC that was started when the computer started (I wrote it in the registry) and this server was "waiting" for a client to connect and receive a message to start the application.
I thought maybe there is a much more simple way to do that like "_spawnl" that runs an exe locally, maybe there is a command that runs an exe on a remote PC...
Ejaz
December 12th, 2002, 03:54 AM
Thats great...
But I'm still confused with one thing.
If the exe is already at the remote computer, then as Valen suggested the ShallExecute API can surve the purpose. But if the .exe is at client and u want to exeute it at remote machine, then, one solution can be, first copy the .exe from client to server and then use ShallExecute API.
Try the link
http://codeguru.earthweb.com/network/FileTransferUsingSockets.shtml
This will give u a very easy and small code to transfer file from one machine to another by using ur own client and server and after that, exeucte it, event u can delete after that. Its all matter of choices of ur own.
Regards,
Ejaz.
penina
December 12th, 2002, 04:11 AM
To make thing clear: I have two computers:
PC A - has an myapp.exe
PC B - From this PC I want to run myapp.exe (which is on PC A) on PC A. (I don't need to copy any file).
I understand that the only solution (You and Ejaz propose)involves sending a message from PC B to PC A (On PC A I have
to place a server that will catch the message) and the Server on PC A will execute myapp.exe with the regular functions.
There is no ShellExe function that I can pass it as a parameter the full path of myapp.exe and it will make it run on the PC where the exe is (and not on the PC that called the ShellExe function).
Ejaz
December 12th, 2002, 08:02 AM
The only other thing can be ... is to use telnet.
Perhaps there can be any other solution of that problem, but I don't think (or may be I'm not good enough at this stage to figure it out).
If ur server is already running at the remote machine, then there will not be much difficulty, but if the server is down and u still want to run the .exe, then the only other solution can telnet.
TheCPUWizard
December 14th, 2002, 10:21 AM
There are MANY other methods (some depending on the target machine OS).
These include .NET remoting, Terminal Services, and others.
Based on the previously posted information on a distributed server type application, the following link provides some good samples..
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vb98/html/vbsmppassthroughserver.asp
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.