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.
- 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
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.
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
- Boot from SCSI virtual hard drive
- PXE boot option
- Secure Boot
- Faster boot time and installation for guest operating system
- Only 64 bit operating systems
- VHDX boot volume can support up to 64 TB