internal static void ProcessKillByName(string name) { int[] pids = ProcessManagement.GetProcessIdsByName(name); // Gets all running processes id by name foreach (int pid in pids) //Iterates through each process id to terminate it { ProcessManagement.TerminateProcessById(pid); } }