The code that I used was
string ProcessStopPid = "CMD.EXE";
ManagementPath mp = new ManagementPath(@"\\"+PCName+@"\ROOT\CIMV2:Win32_Pr ocess");
ManagementObjectCollection mc = new ManagementClass(mp).GetInstances();
foreach(ManagementObject mo in mc)
{
Debug.WriteLine(mo.Properties["Name"].Value.ToString());
if(mo.Properties["Name"].Value.ToString().ToUpper() == ProcessStopPid)
{
object[] methodArgs = {0};
mo.InvokeMethod("Terminate", methodArgs);
}
}
you can change this to ProcessId to kill individual processes but this is ok if you want to kill a group of them
Hope this is helpfull.
--------------------------------
From: Bruce Moulton
-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)
<Id>5YFE03FHJ0WbU/GbnF3GBg==</Id>