Removing stale HostCluster and VMHost from SCVMM 2012 R2

I had seen few cases where deleting a VMHost from SCVMM console may fail. Even with the -Force switch in Powershell will not help. This was based on my experience with the previous versions.

This time also, I got a chance to try it with SCVMM 2012 R2. Worked well.

Here is the sequence.

1) Delete all VMs from this cluster

2) Delete each Host one by one.

Remove-VMHost -VMHost HyperVHostName -Force

3) Once all Hosts are removed, Remove the VMHostCluster

Get-VMHostCluster -Name HostClusterName |Remove-VMHostCluster


Just Remove-VMhostCluster will not help.



PS C:\Users\shaba> Remove-VMHostCluster -VMHostCluster HostClusterName
Remove-SCVMHostCluster : Cannot bind parameter ‘VMHostCluster’. Cannot convert the “HostClusterName” value of type
“System.String” to type “Microsoft.SystemCenter.VirtualMachineManager.HostCluster”.
At line:1 char:37
+ Remove-VMHostCluster -VMHostCluster HostClusterName
+ ~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Remove-SCVMHostCluster], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.SystemCenter.VirtualMachineManager.Cmdlets.RemoveHostClusterCmdlet


Ensure that you have a safe backup before playing around !

Good luck !