SCVMM Shows Error as below
Error (801)
VMM cannot find VM object xxxxxxxxxxxxxxxxxxxxxxxxxx.
Recommended Action
Ensure the library object is valid, and then try the operation again.
Run the following Powershell script. It will remove the VMs with missing VHD info from SCVMM Console. It will not delete the VMs, it will only remove them from SCVMM DB and Console.
Import-Module -Name "virtualmachinemanager"
Get-Vmmserver YOURVMMSERVERNAME
$Cluster = Get-VMHostCluster YOURCLUSTERNAME
$VMHosts = Get-VMHost -VMHostCluster $Cluster
foreach ($VMHost in $VMHosts) {
$VMs=Get-VM -VMHost $VMHost
foreach ($VM in $VMs) {
if (Get-SCVirtualHardDisk -VM $VM) {
#VM is fine, VHD info is fine, do nothing
Write-Host $VM" is Good"
}
else {
#VHD info is bad, delete VM from SCVMM
Write-Host "Removing "$VM
Remove-SCVirtualMachine $VM -force
}
}
foreach ($VM in $VMs) {
if (Read-SCVirtualMachine -VM $VM) {
Write-Host $VM" is Good"
#VM is fine, do nothing
}
else {
#VM info is bad, delete VM from SCVMM
Write-Host "Removing "$VM
Remove-SCVirtualMachine $VM -force
}
}
}