Working with virtual machines in Hyper-V is an issue that involves a global control of numerous functionalities that range from cloning machines to linking services between the physical and virtual parts. We must understand that Hyper-V, being its own and integrated into Windows , by default supports Microsoft's own systems such as:
- Windows Server 2012/2016/2019
This does not mean that it is possible to install and test other systems such as Linux , but in this case being 100% non-compatible systems. It can lead to errors being the non-disconnection of the virtual machine one of them and this make the machine processes remain active and thereby shutting down..
If we try to shut down the virtual machine from the interface, it will simply be frozen with the status "Shutting down" and if a stop-vm "MV" is executed from the console -Force simply fails. If this is your case, TechnoWikis has thought of you because it will give you the solution to correct this error in an integral way.
How to force a virtual machine to shut down in Hyper-V
Step 1
The first step will be to identify the GUID of the virtual machine, for this we access Windows PowerShell as administrators and execute the following:
get-vm | ft VMName, VMid
Step 2
This will result in the name of the virtual machine and its ID:
Step 3
The ID must be copied and then make use of the following syntax with which it seeks to know the processes opened on the server linked to that particular machine:
tasklist / fi "username eq" ID "
Step 4
In this case we enter the following:
tasklist / fi "username eq 4918fe46-7c2e-45c6-a953-f7a76f37a4ee
Step 5
We can see the different services, but we will focus on the process “vmwp.exe†which takes care of the virtual machine boot.
This process has an associated PID, this PID must be stopped with the following syntax:
taskkill / F / PID “pidâ€
For our example we execute the following:
taskkill / F / PID 4056
Step 6
We see that the task is completed correctly, that will automatically stop the virtual machine and we can check it from the Hyper-V console in Windows 10:
With this simple process it is possible to force the virtual machine to shut down in Hyper-V..