从C#windows应用程序中的远程计算机启动进程 [英] Start Process From remote machine in C# windows Application

查看:103
本文介绍了从C#windows应用程序中的远程计算机启动进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从c#中的远程机器启动进程。我试过这段代码,但它给出了错误,因为拒绝访问;

How to start process from remote machine in c#. I tried by this code but it given error as "Access denied;

var processToRun = new[] { "Message.exe" };
var connection = new ConnectionOptions();
connection.Username = "username"
connection.Password = "password"
var wmiScope = new ManagementScope(String.Format(\\\\                                                                                    {0}\\root\\cimv2","PC_NAME"), connection);
var wmiProcess = new ManagementClass(wmiScope, new ManagementPath(Win32_Process), new   ObjectGetOptions());
wmiProcess.InvokeMethod("Create", processToRun);



exe位于E驱动器中,名称为Message.exe。知道如何执行该exe。请分享。没有用户名和密码可以吗?



谢谢。


exe is located in "E" drive with name "Message.exe". Have any idea how to execute that exe. Please share. Is it is possible without username and password?

Thanks.

推荐答案

你好Sachin,


看起来像是一个许可问题。请查看此 KB-317012 [ ^ ]文章。



问候,
Hello Sachin,

Looks like a permission issue to me. Please have a look at this KB-317012[^] Article.

Regards,


这篇关于从C#windows应用程序中的远程计算机启动进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆