Remote Process Execution

一笑奈何 提交于 2019-12-24 04:32:19

问题


My scenerio is connection to remote machine with C#.Net, and listing all processes with that remote computer. I can kill a process, or start a new process at remote. The problem is, when I execute a new process on remote, I can see the process on task manager, but it doesnt apeear on windows screen. Any idea why its not appearing on windows, but appearing on task manager/ process. Here is my execution code

private void btnStartNew_Click(object sender, EventArgs e)
    {
        object[] arrParams = { txtNewProcess.Text.Trim()};
        try
        {
            manageClass = new ManagementClass(myScope, new ManagementPath("Win32_Process"), new ObjectGetOptions());
            manageClass.InvokeMethod("Create", arrParams);
            btnConnect_Click(sender, e);
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.ToString());
        }
    }

My Scope is :

myScope = new ManagementScope(@"\ROOT\CIMV2", connOptions);

回答1:


the problem is about administrator permissions




回答2:


Shouldn't the ManagementPath be something like \ComputerName\Root\CIMV2 instead of just \ROOT\CIMV2 ?




回答3:


If you have trouble with authentication, then you need to check the DCOM configuration on the target machine.

  1. On the target machine, run dcomcnfg from the command prompt.
  2. Expand Component Services\Computers\My Computer\DCOM Config
  3. Find Windows Management Instruction, identified with GUID 8BC3F05E-D86B-11D0-A075-00C04FB68820 (you can see this in the details view).
  4. Edit the properties and then add the username you are trying to login with under the permissions tab.
  5. You may need to reboot the service for the changes to take effect.


来源:https://stackoverflow.com/questions/3166090/remote-process-execution

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!