Wednesday, December 15, 2021

Failed to Restart the Virtual Machine, cannot execute script

From the ESXi host, when we are trying to shut down or restart a virtual machine, it is failed with the below error message.


Failed to restart the virtual machine, cannot execute script


If the vCenter server is failed to perform any task regarding the virtual machine then we can do it directly from the host where that virtual machine is residing. If we are not able to shut down or restart the virtual machine from the vCenter server for any reason then we can do it using the ESXi host. 

We can take two types of access to the ESXi host. The first one is "Graphical Access" and the second one is "Command Line Access". Using the "vSphere Web Client", we can take access to the graphical mode. To work on the command line mode, we can use "ESXi Shell" or we can make an SSH connection from any other network computer.

But, sometimes it will also fail to perform any operation regarding virtual machines from the graphical access. That's why it is good practice to work with command line mode for any VM operation.

In this tutorial, we will stop a VM from the command line mode. We will stop the VM by killing that VM process. Three types of killing methods are available for the virtual machine. We can use any of the methods. By chance, the "Soft" and "Hard" method is failed to kill that VM process then we should use the "Force" method. It will definitely work.

To view the virtual machine list that is running on this host, we will use the below command.


esxcli vm process list


This command will output just like as the below. We will use the "World ID" number to identify the specific VM.




Now we will execute the VM process killing command using that "World ID" number. The command structure is given below.


esxcli vm process kill --type=[soft,hard,force] --world-id=[world-number]


One example for the VM process killing command is given below.


esxcli vm process kill --type=force --world-id=2188667


After executing this command, that virtual machine will be stopped whose "world-id" number is "2188667".

That's all. Using this way, we can turn off or shut down any virtual machine that can't be stopped from the vCenter server.



No comments:

Post a Comment