Any one who can answer my question in detail!!!
-
I actually want to open Notepad on a remote machine. By writing the following code, I am able to run it, but the problem is that it is runs in background. I can only see it by opening up the windows task manager of the remote machine.
ConnectionOptions objConnectionOptions = new ConnectionOptions(); objConnectionOptions.Impersonation = ImpersonationLevel.Impersonate; objConnectionOptions.EnablePrivileges = true; objConnectionOptions.Username = strUserName; objConnectionOptions.Password = strPassword; ManagementScope objManagementScope = new ManagementScope(@"\\remote-computer-name\ROOT\CIMV2", objConnectionOptions); objManagementScope.Connect(); ManagementClass processClassFinal = new ManagementClass(objManagementScope, new ManagementPath("Win32_Process"), null); ManagementBaseObject inParamsFinal = processClassFinal.GetMethodParameters("Create"); inParamsFinal["CommandLine"] = @"c:\windows\notepad.exe"; ManagementBaseObject outParamsFinal = processClassFinal.InvokeMethod("Create", inParamsFinal, null);
Is there anyone who could help me in sorting out this problem Thanks. Sarfraz -
I actually want to open Notepad on a remote machine. By writing the following code, I am able to run it, but the problem is that it is runs in background. I can only see it by opening up the windows task manager of the remote machine.
ConnectionOptions objConnectionOptions = new ConnectionOptions(); objConnectionOptions.Impersonation = ImpersonationLevel.Impersonate; objConnectionOptions.EnablePrivileges = true; objConnectionOptions.Username = strUserName; objConnectionOptions.Password = strPassword; ManagementScope objManagementScope = new ManagementScope(@"\\remote-computer-name\ROOT\CIMV2", objConnectionOptions); objManagementScope.Connect(); ManagementClass processClassFinal = new ManagementClass(objManagementScope, new ManagementPath("Win32_Process"), null); ManagementBaseObject inParamsFinal = processClassFinal.GetMethodParameters("Create"); inParamsFinal["CommandLine"] = @"c:\windows\notepad.exe"; ManagementBaseObject outParamsFinal = processClassFinal.InvokeMethod("Create", inParamsFinal, null);
Is there anyone who could help me in sorting out this problem Thanks. SarfrazI already told you[^] WMI cannot be used to launch an interactive process on a remote machine and what you had to use to accomplish it. How many times are you going to ask this question in one day??
Dave Kreskowiak Microsoft MVP - Visual Basic