Identify Hyper-V VM by worker process if VM is hung on Starting/Snapshotting/Stopping

It’s easy to restart a running VM from Hyper-V Manager but when you have a situation where a number of VM’s running on a production server and you are not able to do this from the Hyper-V manager.

In this case you can make use of VM worker to restart the VM without affecting any other Virtual machines.


For each VM running on Hyper-V would have a virtual machine worker process associated with it, so our goal is to find the associated VM worker and kick that off – This will restart the VM immediately.

  1. Use the below Script to find out the PID of hung VM (Replace the “VM Name” with your VM)

(Get-WmiObject -q “SELECT * FROM Msvm_ComputerSystem WHERE ElementName = ‘VMName'” -n root\virtualization\v2).ProcessID

PS C:\Windows\system32> (Get-WmiObject -q "SELECT * FROM Msvm_ComputerSystem WHERE ElementName = 'VMName'" -n root\v
PS C:\Windows\system32>

2. Now you can use Kill command to restart the VM


This will restart the VM immediately .When you have a minimum number of VM’s running you can use the task manager to identify the process ID which is associated with the VM GUID.


Hyper-V 2012 R2 Generation 1 vs Generation 2 VMs


In earlier versions of Hyper-V, It was not possible to boot a virtual machine from a SCSI virtual hard drive .It was also not possible to copy files from host to virtual machine without having a network connection in the virtual machine .

In virtual machines running 2012 and earlier, the Hyper-V BIOS only supported legacy drives such as IDE controller and legacy network cards.

Starting with windows server 2012 R2, there are two types of Hyper-V boot architectures available.

i.e., Hyper-V BIOS and Hyper v unified extensible firmware interface BIOS, virtual machine created with Generation 1 supports legacy drivers and uses Hyper-V BIOS-based architecture. Hyper-V BIOS-based virtual machines can only initialize IDE Controller for Operating System to initialize a file system, which is shown in the below image

On the other hand, a virtual machine created with Generation 2 supports  UEFI-based architecture, in which a subset of Integration Service components has been included to allow SCSI Controller to initialize before the Operating System starts loading. This is shown in the above image:

Benefits of Generation 2 VMS

  1. Boot from SCSI virtual hard drive
  2. PXE boot option
  3. Secure Boot
  4. Faster boot time and installation for guest operating system
  5. Only 64 bit operating systems
  6. VHDX boot volume can support up to 64 TB