Remove an orphaned VM from SCVMM

During a migration of a VM from a different cluster the job failed in SCVMM.

image

The status of the VM in SCVMM Virtual Machine State is still “Starting”. 

image

In SCVMM I was unable to stop, repair or delete the VM. When looking on the Hyper-V host, the VM didn’t exist in Failover Cluster Manager or Hyper-V manager. After some troubleshooting I was able to use the following PowerShell command to remove the orphaned VM in SCVMM:

Import-Module VirtualMachineManager

Get-VM -VMMServer VMMSERVER –Name “VMNAME" | Remove-VM -Force

Replace the VMMSERVER and VMName  in the PowerShell syntax with your own names

2 thoughts on “Remove an orphaned VM from SCVMM”

  1. Hi, I tried this on my VMM 2012R2 🙁

    PS C:\Windows\system32> get-vm -vmmserver the-kop-vmm -Name “THE-Fotoware” | Remove-VM -Force
    Remove-VM : Unable to acquire a Delete lock on object adcd731f-5631-4a43-a4b8-831735b6947f of type VirtualDVDDrive beca
    use it is locked by task 3413fddf-4f26-48ca-b008-3fb58c338caf (Unknown) with a Read lock. (Error ID: 2606)

    Cancel the task holding the lock or wait for it to complete and try the operation again.

    To restart the job, run the following command:
    PS> Restart-Job -Job (Get-VMMServer the-kop-vmm | Get-Job | where { $_.ID -eq “{f445ab82-927f-479d-82e4-691c8c1a9371}”}
    )
    At line:1 char:54
    + get-vm -vmmserver the-kop-vmm -Name “THE-Fotoware” | Remove-VM -Force
    + ~~~~~~~~~~~~~~~~
    + CategoryInfo : ReadError: (:) [Remove-SCVirtualMachine], CarmineException
    + FullyQualifiedErrorId : 2606,Microsoft.SystemCenter.VirtualMachineManager.Cmdlets.RemoveVMCmdlet

  2. Thnx..was trying with vm name but it was unsuccesful coz it was showing 2 machine exists since it was a failed migration to other host under failover . But ur cmdlet worked like a charm

Leave a Comment