Update all VMs in a cluster to latest configuration level easily

Update all VMs in a cluster to latest configuration level easily

Q. How can I convert all VMs in my Windows cluster to the latest VM configuration version?

A. As new versions of Windows are released the Hyper-V VM configuration level increments such as the new version of Windows Server 2016. Once a cluster is running the new version of Windows Server 2016 you may want to update all VMs to the latest configuration version to enable the new features. An easy way is with the PowerShell below. It will only update VMs that are not running.

$vmgroups = Get-ClusterResource | 
Where-Object{$_.ResourceType -like "Virtual Machine"} 

foreach ($vmgroup in $vmgroups) 
{ 
    $VM = $vmgroup | Get-VM 
    #If VM is off and not already version 8.0
    if($VM.State -eq "Off") # could add this to only update if not a desired version -and $VM.Version -ne "10.0") 
    {
        Write-Output "Updating $($VM.VMName)"
        Update-VMVersion -VM $VM -Force
    }
} 

 

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish