KillProcessInGuest

Oct 19, 2009 at 6:59 PM

Is there any implementation of the method KillProcessInGuest for VMWareLib? I can't seem to find it. Thanks.

http://www.vmware.com/support/developer/vix-api/vix17_reference/lang/com/functions/KillProcessInGuest.html

Coordinator
Oct 19, 2009 at 7:42 PM

Yes.

Enumerate processes, each process instance has a KillProcessInGuest method, so you can get a process by id, enumerate, whatever.

Dictionary guestProcesses = virtualMachine.GuestProcesses;
foreach (KeyValuePair process in guestProcesses)
{
 Console.WriteLine("{0}: {1} [{2}] ({3})", process.Value.Id, process.Value.Name, process.Value.Command, process.Value.Owner);
}

If you launched it:

VMWareVirtualMachine.Process notepadProcess = virtualMachine.DetachProgramInGuest("notepad.exe");
notepadProcess.KillProcessInGuest()