Following an issue with our five node Server 2008 R2 Hyper-V cluster I was left with two entries for one virtual machine (VM) in System Center Virtual Machine Manager 2008 R2 (SCVMM). One entry listed the VM as running, the other as failed, despite the fact that there was nothing wrong with the VM. I was unable to remove the failed entry for the VM using the SCVMM GUI, so used the steps outlined in this KB article http://support.microsoft.com/default.aspx?scid=kb;EN-US;983839 This article is for removing missing VMs, rather than failed ones, so I altered the SQL that is run in step 5. First I ran the SQL below to retrieve the object state of the failed VM
WHERE Name = ‘VMName’
I then ran this code to ensure that I wasn’t going to remove any other VMs. Only the failed VM should be returned by the code below. Change the ObjectState value to the value returned by the code above
WHERE ObjectState = X
As only one VM was returned, I updated the code at the beginning of step 5 of the KB article and replaced the ObjectState value of 220 with the ObjectState for my failed VM. I also applied the hotfix here http://support.microsoft.com/kb/2308590 to guard against similar future issues.