Hi, I am starting a new process (Notepad) on a remote machine but it is
not visible. When I start it on my machine it is visible. What I am
doing wrong ?
private void run_notepad(string machina)
{
ManagementOperationObserver observer = new
ManagementOperationObserver();
completionHandler.MyHandler completionHandlerObj = new
completionHandler.MyHandler();
observer.ObjectReady += new
ObjectReadyEventHandler(completionHandlerObj.Done) ;
string stringMachineName;
string stringCommandLine;
stringCommandLine="c:\\winnt\\notepad.exe";
//Connect to the remote computer
ConnectionOptions co = new ConnectionOptions();
stringMachineName = machina;
//get user and password
if (machina!="")
{
co.Username = "aaa";
co.Password = "******";
}
//Point to machine
System.Management.ManagementScope ms = new
System.Management.ManagementScope("\\\\" + stringMachineName +
"\\root\\cimv2", co);
//get process path
ManagementPath path = new ManagementPath( "Win32_Process");
//Get the object on which the method will be invoked
ManagementClass processClass = new ManagementClass(ms,path,null);
//Create an array containing all arguments for the method
object[] methodArgs = {stringCommandLine, null, null, 0};
//Execute the method
processClass.InvokeMethod (observer, "Create", methodArgs);
Thank you
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!