html5中文学习网

您的位置: 首页 > 网络编程 > ASP.NET » 正文

C#简单实现的远程命令程序_.NET教程_编程技术

[ ] 已经帮助:人解决问题
程序
private void button1_Click(object sender, System.EventArgs e)

{

ConnectionOptions opt=new ConnectionOptions();

opt.Username=UserBox.Text;

opt.Password=PassBox.Text;

ManagementScope scope=new ManagementScope("////"+IPbox.Text+"//root//cimv2",opt);

try

{

scope.Connect();

ObjectGetOptions o = new ObjectGetOptions();

ManagementPath path=new ManagementPath("Win32_Process");

ManagementClass processClass = new ManagementClass(scope,path,o);




ManagementBaseObject inParams = processClass.GetMethodParameters("Create");


inParams["CommandLine"] = CommandBox.Text;




ManagementBaseObject outParams = processClass.InvokeMethod ("Create", inParams, null);

}

catch(Exception ee)

{

MessageBox.Show(ee.Message,"Error");

}

}



private void button2_Click(object sender, System.EventArgs e)

{

Application.Exit();

}

}


CsUHTML5中文学习网 - HTML5先行者学习网
CsUHTML5中文学习网 - HTML5先行者学习网
(责任编辑:)
推荐书籍
推荐资讯
关于HTML5先行者 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 人才招聘 - 帮助