The VM namespace in esxcli is the place to go to carry out operations on running virtual machine processes. There aren’t a lot of options here, so this will be a fairly short post. Running esxcli vm process will show the options available to you:
We will start by listing the virtual machines running on the host by running esxcli vm process list, which will give us an output like this:
The output gives us the names of the VMs, their World IDs and the location of their VMX file, amongst other things. To use the other esxcli vm process command, which is the kill process command, we need the World ID for the virtual machine process we wish to kill. In this case the World ID is 816338. The syntax for the esxcli vm process kill command can be seen below:
From the screenshot we can see that to run the command successfully we need to give it two parameters – the World ID of the virtual machine process and the type, defines how gracefully we want to kill the process. In this example I’m going to use ‘soft’ which gives the process the best chance to shutdown cleanly. With this in mind, the command to run is esxcli vm process kill -w 816338 -t soft, as shown below:
The command doesn’t give us any feedback, but a quick check confirms that the virtual machine is no longer running.