How To Update Hyper-V Configuration Version with Powershell

By updating VM to the most current configuration version on Hyper-v hosts you get the best compatibility option on the VM making the VM best performance on the virtual environment.

Supported VM configuration versions for long-term servicing hosts

The following table lists the VM configuration versions for hosts running a long-term servicing version of Windows.

Hyper-V host Windows version10.09.39.29.19.08.38.28.18.07.17.06.25.0
Windows Server 2022
Windows 10 Enterprise LTSC 2021
Windows Server 2019
Windows 10 Enterprise LTSC 2019
Windows Server 2016
Windows 10 Enterprise 2016 LTSB
Windows 10 Enterprise 2015 LTSB
Windows Server 2012 R2
Windows 8.1

To Check The Hyper-V host Configuration version supported on the host :

Get-VMHostSupportedVersion -ComputerName "Hyper-v host name"

To check the current configuration version running the of all the VM running on one Hyper-v host :

Get-VM -ComputerName "Hyper-v host name" * | Format-Table Name, Version

To upgrade the VM configuration version you first need the shut down the VM, then execute :

Get-VM -ComputerName "Hyper-V Host Name" "VM name" | Update-VMVersion

Start the VM, You can also check on the Hyper-V manager the current running configuration version

Here is a powershell script that automatically upgrade all the VM’s on Hyper-v Host from Version 5

# Check configuration version of each VM on the Hyper-V host
$vms = Get-VM

foreach ($vm in $vms) {
    $vmName = $vm.Name
    $vmConfigVersion = $vm.Version

    Write-Host "Virtual Machine: $vmName"
    Write-Host "Configuration Version: $vmConfigVersion"

    # If configuration version is 5, upgrade it
    if ($vmConfigVersion -eq "5.0") {
        Write-Host "Shutting down $vmName..."
        Stop-VM -Name $vmName -Force

        # Upgrade configuration version
        Write-Host "Upgrading configuration version of $vmName..."
        Update-VMVersion -Name $vmName -Force

        # Start the VM
        Write-Host "Starting $vmName..."
        Start-VM -Name $vmName
    }
    else {
        Write-Host "$vmName is already on a higher configuration version. Skipping..."
    }

    Write-Host ""
}

Leave a Reply

Your email address will not be published. Required fields are marked *