首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我正在尝试使用WMI运行命令

我正在尝试使用WMI运行命令
EN

Stack Overflow用户
提问于 2010-05-07 00:46:16
回答 1查看 1.6K关注 0票数 1

这是我的代码:单击一个按钮,并将textbox中的文本作为remotePC。我可以在本地运行它,但当我尝试远程运行它时,它不会工作,我想这与使用WMI运行共享文件有关?

代码语言:javascript
复制
public void IPXFER(string RemotePC)
{    
    object[] theProcessToRun = { @"\\network-share\ipxfer\ipxfer.exe -s corp-trend -p 1234 -m 1 -c 12345" };
    ConnectionOptions theConnection = new ConnectionOptions();
    theConnection.Impersonation = ImpersonationLevel.Impersonate;
    theConnection.EnablePrivileges = true;
    ManagementScope theScope = new ManagementScope("\\\\" + RemotePC + "\\root\\cimv2", theConnection);
    ManagementClass theClass = new ManagementClass(theScope, new ManagementPath("Win32_Process"), new ObjectGetOptions());
    theClass.InvokeMethod("Create", theProcessToRun);
}
EN

回答 1

Stack Overflow用户

发布于 2010-05-07 04:02:33

我最终使用了file.copy,然后用WMI的开关执行exe,解决了这个问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2782811

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档