Note: This article is based on VMM 2008 and might not apply to VMM 2012 (R2) If you ever find yourself in a position where you tried to remove a VM but it ended up being stuck in a state of limbo then this one’s for you:
========
Issue: A VM has been removed from SCVMM but still appears in the VMM Admin Console. The VM may have been removed in Hyper-V, SCVMM, or Cluster Administrator. When the VM is right clicked on there are two choices: Repair and Delete. Neither work.
Environment: Windows 2003 with SCVMM 2007 Windows 2008 with SCVMM 2008
Resolution: If after attempting to remove the VM through normal means the machine name is still present, perform these steps:
> Method 1: Locate the .XML file for the machine and delete it. - On the host that the VM ran on (or hosts if you are unsure which one), at a command prompt: Type the drive letter to change to such as C: and hit enter, then... dir *.xml /s | find /i "vm name" - Replacing "vm name" with the name of the VM, this will search a volume for the .XML file that describes the VM - Move the .XML file to a location that SCVMM does not use for hosted VMs or Library files - Refresh SCVMM Admin Console
> Method 2: Force removal of VM with PowerShell. If Method 1 did not work, follow the steps below then refresh the SCVMM Admin Console:
- In the SCVMM Admin Console click the 'PowerShell' button. Type 'A' for 'Always' if prompted by security - Test PowerShell (this will just list information so that you will know that PowerShell is working properly): Get-VMMServer -ComputerName localhost - This should just list out some VMM info
- Remove VM: Replace "VM Name" with the name of the VM as it appears in SCVMM $VM = Get-VM -Name "VM Name" Remove-VM -VM $VM -Force
Note: If the virtual machine still exists as an .XML file as mentioned in Method 1, refresher will repopulate the VM as being present
Special thanks to Jonathan Jordan who originally documented this issue.
ref: http://blogs.technet.com/scvmm/archive/2009/04/29/how-to-forcefully-remove-a-virtual-machine-from-the-scvmm-admin-console.aspx
Danny van Dam edited Revision 3. Comment: added note about that this might not apply to VMM 2012 (R2)
Carsten Siemens edited Revision 2. Comment: Added tag: en-US
Danny van Dam edited Revision 1. Comment: added vmm server version to title