VMM – One Liner to dismiss failed state

A colleague asked me today about a one line command to remove the ‘failed’ state of all VMs, I thought I’d share this in case anyone else has had this problem:

(remember to run from VMM powershell)

Get-SCVirtualMachine | Repair-SCVirtualMachine -Dismiss

VMM Error 25122

This error can occur after manually adding a Hyper-V cluster to VMM 2012 R2. It appears to occur because the Cluster Virtual IP address exists in the IP pool


VMM 25122

The script is below, credits to vNikkas who has also blogged about this (there was another version floating around last year too I believe).

$ID = Enter the ID found in the error message (you can copy the text, paste into notepad and then copy the ID

$IPPoolName = Enter the name of the IP pool associated with the error message

If (-not (Get-Module virtualmachinemanager)) {
Import-Module virtualmachinemanager }

$IP = Get-SCIPAddress | Where-Object {$_.ID -eq $ID}
$IPPool = Get-SCStaticIPAddressPool -Name $IPPoolName
# Looking up DNS Name based on IP Address
$VMHostClusterName = [System.Net.Dns]::GetHostbyAddress($IP.Name)
$VMHostCluster = Get-SCVMHostCluster -Name $VMHostClusterName.HostName

# Giving the IP Address back to the IP Pool
Get-SCIPAddress -IPAddress $IP | Revoke-SCIPAddress

# Allocating the IP Address to the VM Host Cluster
Grant-SCIPAddress -GrantToObjectType HostCluster -GrantToObjectID $VMHostCluster.ID -IPAddress $IP.Name -StaticIPAddressPool $IPPool -Description $VMHostCluster.Name

VMM 2012 R2 – Common Task: Checking Integration Services

Integration Services provide a number of benefits to virtual machines and should be kept up to date. Integration Services or ‘VM Additions’ are to Hyper-V VMs what VMware tools is to VMware VMs. Sometimes updates to Hyper-V will update the version of the ‘VM Additions’ available.

The Integration Services can be checked using the VMM Console. First select the ‘VMs and Services’ tab followed by the ‘All Hosts’ tab. This will display a list of all the VMs in the environment. Find the column labelled ‘VM Additions’, if it is not visible right click in the grey area (by VM Name) and select ‘VM Additions’

From VMM Powershell you can run the following command:
Get-VM | ft Name, VMAddition

To determine the version of integration services that is installed on the Hyper-V management operating system, check the registry key that has the version of the current Hyper-V Guest Installer: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization\GuestInstaller\Version\Microsoft-Hyper-V-Guest-Installer-Win60-Package. The value in the Data column is the version number.
(Reference – Technet http://technet.microsoft.com/en-us/library/ee207413(v=ws.10).aspx )

To determine the version information for a guest VM operating system, log on to the guest operating system and check the version of the drivers installed in the \System32 folder. For example, C:\Windows\System32\drivers\vmbus.sys has a file version that should match the number found in the registry key on the management operating system.
(Reference – Technet http://technet.microsoft.com/en-us/library/ee207413(v=ws.10).aspx )

VMM 2012 R2 – Bare-Metal Deployment Fails with Error 21161

Issue: Bare-Metal Deployments were failing. This was occurring after deep discovery had been completed and a build job had been initiated.
Exact Error Message: Error (21161) No available VHD resource was found within the host group.

The VHDs were present and builds had been working fine until recently. I checked all the logs and ran a VMM trace. The VMM trace indicated that there was a database inconsistency.

The VMM server had recently been updated to UR3.

Unfortunately the fix was to roll back to pre-UR3. This involved taking a fresh DB backup. Rolling back to the pre-UR3 backup in SQL, and uninstalling the updates from the VMM server.

Following this was the task of recreating any VMM objects that had been present, removing and adding hosts back (as the agent version was ahead-of-date).

This highlights how important regular SQL backups are for VMM servers as well as testing (as much as possible) after an Update Rollup.

EDIT: Niklas Akerlund has recently ran into the same error and has identified another fix for the issue, I can confirm that the fix outlined by Niklas works great! thanks Nicklas.


VMM 2012 R2 Error 12711 (VMM cannot complete WMI operation on the server) Removing an Orphaned Clustered Resource (Failover Cluster 2012 R2)

Sometimes admins attempt to repair VMs, not knowing about the relationship between VMM/Failover-Clustering/Hyper-v they fix up a VM to a working state, leaving empty orphaned cluster resources behind, and also causing VMM to report error 12711.

To fix these resources we need to get into powershell and connect to the cluster.

Start with a “Get-ClusterResource” and see if you can see it, try remove it using the “Remove-ClusterResouce” command first, if this fails (as it sometimes does if its an empty VM resource) then we can try removing its group with contents

do a “Get-ClusterGroup” and identify the name, now try “Get-ClusterGroup nameofGroup | Remove-ClusterGroup”

still not working? -group is not empty error? thats fine try “Get-ClusterGroup nameofGroup | Remove-ClusterGroup -RemoveResouces”

SCVMM 2012 R2 – Error 20506 / 20552 / 2606

Had an interesting issue today, All hosts spread over two clusters were in a state of ‘not responding’ with no clear explanation why.

It looked as though the issue began at 2am, a time when nobody would have been working on the VMM console.

Initial diagnosis showed that the network was up, The Failover Cluster was working just fine, but VMM had lost WinRM connectivity to the hosts.

The usual error 20506 appeared in the host status window indicating that WinRM “could not complete the Windows Remote Management request on computer xxx”

Furthermore each time the Refresh Host Cluster job would fail it would show errors

2606 – unable to perform the job because on or more of the selected objects are locked by another job

20552 – VMM does not have appropriate permissions to access the resource on the xxx server

I spent a fail amount of time looking into the WinRM issue, everything was fine and nothing had changed. WinRM tests showed that the VMM server was able to communicate with the hosts.

I looked for locked jobs or running jobs, even checking the SQL server using the query

SELECT * FROM [VirtualManagerDB].[dbo].[tbl_VMM_Lock] where TaskID=’Task_GUID’ (See http://support.microsoft.com/kb/2795040 )

but that showed no jobs were active at all.


The thing that resolved it, was running another job (a non cluster related job) in my case i changed a run-as account. As soon as this went through I was able to refresh the cluster just fine.

I cant completely explain this one, my guess is that a phantom job had gotten stuck somewhere. Thought i would share the results.