Three ways to run remote Windows commands http://4sysops.com/archives/three-ways-to-run-remote-windows-commands/Method 1: Use Sysinternals’ PSExec Method 2: Use WMI to run remote commands Method 3: Use ControlUp to run remote commands文件操作啥意思?直接共享后,写局域网文件 File.***("\\computername\aaa\bbb.txt")?要有权限。
当然你也可以使用ssh/powershell之类的管理工具,自己google。
如果没有密码 是木马或者远程控制类的 C#做是可以 但是有个问题
别人如果想在电脑上运行你的木马 还要下载个几十兆的.NetFramework
http://4sysops.com/archives/three-ways-to-run-remote-windows-commands/Method 1: Use Sysinternals’ PSExec
Method 2: Use WMI to run remote commands
Method 3: Use ControlUp to run remote commands文件操作啥意思?直接共享后,写局域网文件 File.***("\\computername\aaa\bbb.txt")?要有权限。
大家帮我看看这两个方法有什么问题么?
// 验证是否能连接到远程计算机
public static bool RemoteConnectValidate(string host, string userName, string password)
{
ConnectionOptions connOption = new ConnectionOptions();
connOption.Username = host + @"\" + userName;
connOption.Password = password; ManagementPath mngPath = new ManagementPath(@"\\" + host + @"\root\cimv2:Win32_Process");
ManagementScope scope = new ManagementScope(mngPath, connOption); try
{
scope.Connect();
}
catch
{
}
return scope.IsConnected;
}
//执行cmd命令
public void ExecutionCmd(string strCommand,string host)
{
ManagementPath mngPath = new ManagementPath(@"\\" + host + @"\root\cimv2:Win32_Process");
ObjectGetOptions objOption = new ObjectGetOptions();
ManagementClass classInstance = new ManagementClass(managementScope, mngPath, objOption);
int ProcessId = 0;
object[] cmdline = { "cmd/c " + strCommand, mngPath, null, ProcessId };
//调用执行命令的方法
classInstance.InvokeMethod("Create", cmdline); }
我还想了解root\cimv2:Win32_Process是什么意思,谢谢大家了