SCVMM

All posts tagged SCVMM

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
		}
	}
}

When right-clicking on the Virtual Machine and clicking on Properties, the VMM Console Crashes. When you check the Event Logs, it shows the error similar to this:

Description:
Stopped working

Problem signature:
Problem Event Name : CLR20r3
Problem Signature 01: vmmadmin.exe
Problem Signature 02: 1.0.523.0
Problem Signature 03: 4d432cdf
Problem Signature 04: System.Windows.Forms
Problem Signature 05: 2.0.0.0
Problem Signature 06: 4f682206
Problem Signature 07: 14d0
Problem Signature 08: 23
Problem Signature 09: System.ObjectDisposedException
OS Version: 6.1.7601.2.1.0.274.10
Locale ID: 1033

Try the following to fix the the issue:

Open VMM Powershell prompt and run the following command

Get-VM -Name “Name of the VM” | Remove-VM -Force

The VM should stay online but will be removed from the VMM. It will reappear automatically after a while or you can right-click the host and Refresh Virtual Machines.

If you are running Hyper-V Failover Cluster and managing it using SCVMM you would have noticed that when you create a new VM in SCVMM, the VM name in the Failover Cluster Manager shows as “SCVMM VMNAME Resources”.

Also, if you rename a VM in SCVMM or Hyper-V Manager it does not get updated in Failover Cluster Manager and vice versa.  This creates issues if you have alot of VMs to manage and then if you need to rename a VM.

To resolve this issue, I wrote a small script using Powershell. This script can be run in two modes:

  1. Compare the VM names in Failover Cluster and SCVMM and list the VMs with mismatching names.
  2. Rename the VMs in Failover Cluster to match the SCVMM names.

There are three variables that you need to check/change before running the script:

  1. $VMMServer: This is your VMM Server FQDN
  2. $Cluster: This is your Failover Cluster FQDN
  3. $Mode: If you set it to “1” it will list the VMs with mismatch names, if you set it to “2” it will rename the VMs

If this script works for you and solves your issue, please leave a comment.

Download the script below