Hi,

I have written a small application that analises several logs locally (sizes may be up to 300 MB). I'm now building an application that is able to execute

and control that process on every machine.
For that, I've read to use WMI to start a process on a remote machine (same LAN), but found several problems:

The application must reside on the remote machine, which is not valid for me (I can launch the exe i.e psexec -c app.exe or somehow "send" the code to

the machine)
Second, the code below works but I can't see anything on the screen, I see the process though.

class Program
{
static void Main(string[] args)
{
string hostname = "k2";

try
{

ConnectionOptions theConnection = new ConnectionOptions();
theConnection.Impersonation = ImpersonationLevel.Impersonate;
theConnection.Username = "salva";
theConnection.Password = "salva";

//ManagementScope theScope = new ManagementScope("\\\\" + IP + "\\root\\cimv2", theConnection);
ManagementScope theScope = new ManagementScope(@"\\" + hostname + @"\root\cimv2", theConnection);

ManagementClass theClass = new ManagementClass(theScope, new ManagementPath("Win32_Process"), new ObjectGetOptions());

ManagementBaseObject inParams = theClass.GetMethodParameters("Create");
//inParams["CommandLine"] = @"\\" + IP + "\\admin$\\ipconfig";
inParams["CommandLine"] = "notepad";
ManagementBaseObject outParams = theClass.InvokeMethod("Create", inParams, null);

Console.WriteLine("Creation of the process returned: " + outParams["returnValue"]);
Console.WriteLine("Process ID: " + outParams["processId"]);

}
catch (ManagementException ex) {
Console.WriteLine(ex.Message);
}
Console.ReadLine();
}


Any idea?

Cheers.