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.

pic01

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
irtualization\v2).ProcessID
2676
PS C:\Windows\system32>

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

pic3

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.

 

Configuring MPIO in Windows Server 2012 R2

We are going to configure a Hyper-V server to use an iSCSI target space for storing the VM files. Since the VM’s are loading from the remote storage it’s very crucial to have a high input/output operations over the network without any breach in latency.

tt

Here we are going to provide three paths for Hyper-V host to reach the storage server which will be working on a round robin policy. Please refer MPIO polices in details here .For better understanding we can split this configuration steps in to three phases ,please use the below link to view the configuration steps.

Click here to get the configuration guide .