Does anybody knows how can I execute a process from one machine in another
one?
For example:
I´m executing a "From.exe" file in a machine A, and the code of
"From.exe" in that machine execute another "To.exe" file in machine B, so
the machine B now have a process called "To.exe" running.
Is that possible?

Thanks!!!
Ronan

Re: Starting a remote process by Nnamdi

Nnamdi
Tue Jun 29 10:10:00 CDT 2004

Why dont you make a small applicaiton to run in the background on computer B
that recieves messages from A to execute applications?



Re: Starting a remote process by Phil

Phil
Tue Jun 29 10:12:44 CDT 2004

You can do this with WMI (the Management classes in the framework, like
ManagementClass) and the WMI Win32_Process class. You can attach to WMI on
the remote system and use the Create method of Win32_Process. This is the
kind of thing below. ConnectionOptions has username and password properties
if you need to run in a different account.

ConnectionOptions coptions = new ConnectionOptions();
string workingdir = "C:\\Temp";
string mcommand = "notepad";
string servername = "remoteserver";
ManagementScope scope = new ManagementScope("\\\\" + servername +
"\\root\\cimv2", coptions);
try
{
scope.Connect();
ManagementPath mp = new ManagementPath("Win32_Process");
ManagementClass mo = new ManagementClass (scope, mp, new
ObjectGetOptions(null, new TimeSpan(0,0,0,5), true) );
ManagementBaseObject inParams = mo.GetMethodParameters ("Create");
InvokeMethodOptions options = new InvokeMethodOptions();
inParams["CommandLine"] = mcommand;
inParams ["CurrentDirectory"] = workingdir;
ManagementBaseObject mbo = mo.InvokeMethod( "Create", inParams,
options);
object rv = mbo ["returnvalue"];
object prid = mbo ["processid"];
}
catch (Exception e)
{
Console.WriteLine("Failed to connect: " + e.Message);
}

--
Phil Wilson
[MVP Windows Installer]
Definitive Guide to Windows Installer
http://www.amazon.com/exec/obidos/tg/detail/-/1590592972/104-7044380-4696760

"Ronan" <netRonan@Bancoob.com.br> wrote in message
news:%23A1wSuVXEHA.2844@TK2MSFTNGP11.phx.gbl...
> Does anybody knows how can I execute a process from one machine in another
> one?
> For example:
> I´m executing a "From.exe" file in a machine A, and the code of
> "From.exe" in that machine execute another "To.exe" file in machine B, so
> the machine B now have a process called "To.exe" running.
> Is that possible?
>
> Thanks!!!
> Ronan
>
>