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(str ing machina)
{
ManagementOpera tionObserver observer = new
ManagementOpera tionObserver();
completionHandl er.MyHandler completionHandl erObj = new
completionHandl er.MyHandler();
observer.Object Ready += new
ObjectReadyEven tHandler(comple tionHandlerObj. Done);
string stringMachineNa me;
string stringCommandLi ne;
stringCommandLi ne="c:\\winnt\\ notepad.exe";
//Connect to the remote computer
ConnectionOptio ns co = new ConnectionOptio ns();
stringMachineNa me = machina;
//get user and password
if (machina!="")
{
co.Username = "aaa";
co.Password = "******";
}
//Point to machine
System.Manageme nt.ManagementSc ope ms = new
System.Manageme nt.ManagementSc ope("\\\\" + stringMachineNa me +
"\\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 = {stringCommandL ine, null, null, 0};
//Execute the method
processClass.In vokeMethod (observer, "Create", methodArgs);
Thank you
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!