My buddy Jonathan Jordan recently came across an interesting issue and wrote up a great solution, and since he’s out today I thought I’d take the liberty of posting it. 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
Thanks for this post, this has been a big point of frustration for customers.
The following steps outline the procedure to manually remove a host cluster from the VMM database. In
If you’ve ever tried deleting a VM from the SCVMM console but it still hangs around this post could help
This probably works just fine, but if you are using a SAN and delete the partition hosting the VM, it is still unable to delete the VM from within the GUI. I am still looking for a way to remove the entry within the SCVMM 2008 R2 Management Console.
I have tried both methods but it did not work. For method 2 specifically, after typing the "Remove-VM..." line, I get an error:
Remove-VM: Cannot convert 'System.Object[]' to the type 'Microsoft.SystemCenter.VirtualMachineManager.VM' required by parameter 'VM'. Specified method is not supported.
At line:1 char:14
+ Remove-VM -VM <<< $VM -Force
+ Category Info :InvalidArgument: <:> [Remove-VM], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgument, Microsoft.SystemCenter.VirtualMachineManager.Cmdlets.RemoveVMCmdlet
I did both options and I get the following Error with Option 2:
Remove-VM : VMM Cannot find VirtualHardDisk Object <VHD ID>. <Error ID: 801>
It's more cosmetic than anything, don't like the warnings I repeatedly get...so any ideas would be helpful - using VMM2012 on 08R2
Thanks you very much. Force remove really worked for me.
thank you