Removing Orphaned Virtual Machine Objects in SCVMM (System Center Virtual Machine Manager)

October 25, 2017

tags:
no comments

 

When Managing Virtual Machines via both Hyper-V and SCVMM Sometimes the bond between the Virtual Machine Object on SCVMM and The Hyper-V Breaks

This Bond is based on a Property Named VMID that Exists in Both Objects Called VMID

When Issue occurs There is a Stale orphaned Virtual Machine object in the SCVMM console and all actions taken on it will fail because the object has no equivalent Virtual Machine in Hyper-V.

There is no way to delete this orphaned Virtual Machine Via the Console GUI only thru the powershell command Remove-SCVirtualMachine with the Force Switch(-force).

In many cases this happens when a Virtual Machine is Created Deleted and Created Again in a short amount of time, in this case we would have 2 objects for the Virtual Machine in SCVMM one that will have the Correct vmid and the second with a VMID that has no equivalent in the Hyper-V manager So we must delete the correct object in SCVMM the one with the Wrong VMID.

To get the VMID on hyper-V use the command get-vm XXXXXX

clip_image002

To get the VMID in SCVMM you can use the command Get-SCVirtualMachine

clip_image004

So when Deleting the object Make Sure you are deleting the Orphaned object and not the Correct object the way to do it is from SCVMM powershell interface :

$vm=Get-SCVirtualMachine |?{$_.vmid -ne “3C6E6982-958B-4703-967B-245457381C26” -and $_.Name -eq “XXXXXX”}

Remove-SCVirtualMachine -VM $vm -Force

 

Sagi U.

Add comment
facebook linkedin twitter email

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*