| Код | System.Diagnostics.Process.Start("net", "send * test");
|
| Код | System.Diagnostics.Process p = new System.Diagnostics.Process(); p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; p.StartInfo.FileName = "net"; p.StartInfo.Arguments = "send * test"; p.Start();
|
**********************************************
| Код | public void RunCommand(string commandLine) { try { //Process.Start("net", "user " + un.Text + " " + np.Text);
ManagementPath path = new ManagementPath("Win32_Process");
ConnectionOptions options = new ConnectionOptions(); options.Impersonation = ImpersonationLevel.Impersonate; options.Authentication = AuthenticationLevel.PacketPrivacy;
ManagementClass classInstance = new ManagementClass( path, new ObjectGetOptions());
classInstance.InvokeMethod("Create", new object[] { commandLine }); } catch (Exception exp) { Response.Write(exp.Message); } }
|
для удален. комп.
| Код | public void RunCommand(string commandLine, string machineName, string userName, string password) { ManagementPath path = new ManagementPath(@"\\" + machineName + @"\root\cimv2:Win32_Process");
ConnectionOptions options = new ConnectionOptions(); options.Username = userName; options.Password = password; options.Impersonation = ImpersonationLevel.Impersonate; options.Authentication = AuthenticationLevel.PacketPrivacy;
ManagementScope scope = new ManagementScope(path, options);
ManagementClass classInstance = new ManagementClass(scope, path, new ObjectGetOptions());
classInstance.InvokeMethod("Create", new object[] { commandLine }); }
|
|