2

Am I right in thinking that if a program is run as a user, and the program tries to kill another process started by the same user, this will succeed? And that the user would need to be in the Administrators group to kill any other process (including SYSTEM etc)?

Am I missing anything? Am I wrong/right?

5
  • 2
    Good inquiry, but have you tested your assumption? Generally, stackoverflow is for helping you solve problems that you can't solve on your own. Why not give this one a go on your own first? Sep 13, 2012 at 14:31
  • 5
    You need a license to kill :) Sep 13, 2012 at 14:31
  • It's possible that you'll need the SE_DEBUG_PRIVILEGE for some processes. Sep 13, 2012 at 14:32
  • 1
    why don't you try it out and see? Sep 13, 2012 at 14:46
  • What if you try and kill your own process?
    – Brain2000
    Jul 27, 2018 at 19:28

1 Answer 1

3

These articles Permissions for Process.Kill() and Tip 13 : Kill a process using C#, from local to remote I'm sure will aid in testing your assumptions.

** EDIT **

The salient information in those articles is as follows (in case the links are down):

using System.Management;
using System.Management.Instrumentation;

ManagementScope scope = new ManagementScope("\\\\RemoteMachineName\\root\\cimv2");
scope.Connect();

ObjectQuery query = new ObjectQuery("SELECT * FROM Win32_Process WHERE Name='ProcessName'");
ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query);

ManagementObjectCollection objectCollection = searcher.Get();
foreach(ManagementObject managementObject in objectCollection)
{
   managementObject.InvokeMethod("Terminate", null);
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.