When you delete a VM from the ESXI console which is connected to Vcenter, most of the time it will reflect in Vcenter as Orphaned, the VM won’t be fully removed.
In such a case connect to the Vcenter using PowerCLI and then delete it using the command line.
#Connect to VCenter
Connect-VIServer x.x.x.x
#Get VM details
Get-VM
#Remove the orphaned VM
Remove-VM ServerName
In some cases, we may get the error “Exception has been thrown by the target of an invocation.” In such cases trying to remove the orphaned VM from a different device generally resolves the issue.
- KB170084