在 Windows 10 或 Windows Server 上的 HYPER-V 中虚拟机版本升级Upgrade virtual machine version in Hyper-V on Windows 10 or Windows Server

适用于:Windows 10、windows Server 2019,Windows Server 2016 中,Windows Server (半年频道)Applies To: Windows 10, Windows Server 2019, Windows Server 2016, Windows Server (Semi-Annual Channel)

提供的最新的 HYPER-V 功能在虚拟机上通过升级配置版本。Make the latest Hyper-V features available on your virtual machines by upgrading the configuration version. 不执行前此操作:Don't do this until:

  • 升级到最新版本的 Windows 或 Windows Server 的 HYPER-V 主机。You upgrade your Hyper-V hosts to the latest version of Windows or Windows Server.
  • 升级群集功能级别。You upgrade the cluster functional level.
  • 您一定不会需要将虚拟机移回运行 Windows 或 Windows Server 的早期版本的 HYPER-V 主机。You're sure that you won't need to move the virtual machine back to a Hyper-V host that runs a previous version of Windows or Windows Server.

有关详细信息,请参阅群集操作系统滚动升级在 VMM 中执行的 HYPER-V 主机群集滚动升级For more information, see Cluster Operating System Rolling Upgrade and Perform a rolling upgrade of a Hyper-V host cluster in VMM.

第 1 步:检查虚拟机配置版本Step 1: Check the virtual machine configuration versions

  1. 在 Windows 桌面上,单击“开始”按钮并键入名称 Windows PowerShell 的任一部分。On the Windows desktop, click the Start button and type any part of the name Windows PowerShell.
  2. 右键单击 Windows PowerShell,然后选择以管理员身份运行Right-click Windows PowerShell and select Run as Administrator.
  3. 使用GET-VMcmdlet。Use the Get-VMcmdlet. 运行以下命令以获取你的虚拟机的版本。Run the following command to get the versions of your virtual machines.
Get-VM * | Format-Table Name, Version

您还可以查看配置版本的 HYPER-V 管理器中选择的虚拟机并查看摘要选项卡。You can also see the configuration version in Hyper-V Manager by selecting the virtual machine and looking at the Summary tab.

步骤 2:升级虚拟机配置版本Step 2: Upgrade the virtual machine configuration version

  1. 关闭 Hyper-v 管理器中的虚拟机。Shut down the virtual machine in Hyper-V Manager.
  2. 选择操作 > 升级配置版本。Select Action > Upgrade Configuration Version. 如果此选项不适用于虚拟机,然后它是已最高配置版本支持的 HYPER-V 主机。If this option isn't available for the virtual machine, then it's already at the highest configuration version supported by the Hyper-V host.

若要使用 Windows PowerShell 升级虚拟机配置版本,请使用Update-vmversion cmdlet。To upgrade the virtual machine configuration version by using Windows PowerShell, use the Update-VMVersion cmdlet. 运行以下命令,其中 vmname 是虚拟机的名称。Run the following command where vmname is the name of the virtual machine.

Update-VMVersion <vmname>

支持的虚拟机配置版本Supported virtual machine configuration versions

运行 PowerShell cmdlet Get VMHostSupportedVersion若要查看的 HYPER-V 主机支持哪些虚拟机配置版本。Run the PowerShell cmdlet Get-VMHostSupportedVersion to see what virtual machine configuration versions your Hyper-V Host supports. 当你创建虚拟机时,则使用默认配置版本创建它。When you create a virtual machine, it's created with the default configuration version. 若要查看默认值,请运行以下命令。To see what the default is, run the following command.

Get-VMHostSupportedVersion -Default

如果你需要创建可以将它们移到 HYPER-V 主机的虚拟机运行较旧版本的 Windows,使用NEW-VM cmdlet 与-version 参数。If you need to create a virtual machine that you can move to a Hyper-V Host that runs an older version of Windows, use the New-VM cmdlet with the -version parameter. 例如,若要创建可以将它们移动到运行 Windows Server 2012 R2 的 HYPER-V 主机的虚拟机,请运行以下命令。For example, to create a virtual machine that you can move to a Hyper-V host that runs Windows Server 2012 R2 , run the following command. 此命令将创建虚拟机配置版本 5.0 创建名为"WindowsCV5"。This command will create a virtual machine named "WindowsCV5" with a configuration version 5.0.

New-VM -Name "WindowsCV5" -Version 5.0

备注

可以导入已为运行 Windows 的较旧版本的 HYPER-V 主机创建的虚拟机或从备份中还原它们。You can import virtual machines that have been created for a Hyper-V host running an older version of Windows or restore them from backup. 如果 VM 的配置版本未列出所支持的 HYPER-V 主机操作系统下表中,您必须更新虚拟机配置版本,然后才能启动 VM。If the VM's configuration version is not listed as supported for your Hyper-V host OS in the table below, you have to update the VM configuration version before you can start the VM.

支持的长期维护主机的虚拟机配置版本Supported VM configuration versions for long-term servicing hosts

下表列出了支持运行 Windows 的长期维护服务版本的主机的虚拟机配置版本。The following table lists the VM configuration versions that are supported on hosts running a long-term servicing version of Windows.

Windows 版本的 HYPER-V 主机Hyper-V host Windows version 9.19.1 9.09.0 8.38.3 8.28.2 8.18.1 8.08.0 7.17.1 7.07.0 6.26.2 5.05.0
Windows Server 2019Windows Server 2019
Windows 10 企业版 LTSC 2019Windows 10 Enterprise LTSC 2019
Windows Server 2016Windows Server 2016
Windows 10 企业版 2016 长期服务Windows 10 Enterprise 2016 LTSB
Windows 10 企业版 2015 LTSBWindows 10 Enterprise 2015 LTSB
Windows Server 2012 R2Windows Server 2012 R2
Windows 8.1Windows 8.1

每半年频道主机的受支持的 VM 配置版本Supported VM configuration versions for semi-annual channel hosts

下表列出了对于运行 Windows 的当前支持的半年频道版本的主机的 VM 配置版本。The following table lists the VM configuration versions for hosts running a currently supported semi-annual channel version of Windows. 若要获取每半年频道版本的 Windows 上的详细信息,请访问以下页面了解Windows ServerWindows 10To get more information on semi-annual channel versions of Windows, visit the following pages for Windows Server and Windows 10

Windows 版本的 HYPER-V 主机Hyper-V host Windows version 9.19.1 9.09.0 8.38.3 8.28.2 8.18.1 8.08.0 7.17.1 7.07.0 6.26.2 5.05.0
Windows 10 可能 2019年更新 (版本 1903年)Windows 10 May 2019 Update (version 1903)
Windows Server 版本 1903Windows Server, version 1903
Windows Server 版本 1809Windows Server, version 1809
Windows 10 2018 年 10 月更新 (版本 1809年)Windows 10 October 2018 Update (version 1809)
Windows Server 版本 1803Windows Server, version 1803
Windows 10 2018 年 4 月更新 (版本 1803年)Windows 10 April 2018 Update (version 1803)
Windows 10 Fall Creators Update (版本 1709年)Windows 10 Fall Creators Update (version 1709)
Windows 10 创意者更新 (1703 版本)Windows 10 Creators Update (version 1703)
Windows 10 周年更新 (版本 1607年)Windows 10 Anniversary Update (version 1607)

为什么应该升级虚拟机配置版本?Why should I upgrade the virtual machine configuration version?

当移动或虚拟机导入到 Windows Server 2019、 Windows Server 2016 或 Windows 10 中,虚拟机运行 HYPER-V 的计算机"不会自动更新配置。When you move or import a virtual machine to a computer that runs Hyper-V on Windows Server 2019, Windows Server 2016, or Windows 10, the virtual machine"s configuration isn't automatically updated. 这意味着,你可以移动虚拟机返回到运行 Windows 或 Windows Server 的早期版本的 HYPER-V 主机。This means that you can move the virtual machine back to a Hyper-V host that runs a previous version of Windows or Windows Server. 但是,这也意味着,您不能使用的一些新的虚拟机功能直到手动更新配置版本。But, this also means that you can't use some of the new virtual machine features until you manually update the configuration version. 已升级后,不能降级虚拟机配置版本。You can't downgrade the virtual machine configuration version after you've upgraded it.

虚拟机配置版本表示虚拟机的配置,使用的版本的 HYPER-V 保存状态和快照文件的兼容性。The virtual machine configuration version represents the compatibility of the virtual machine's configuration, saved state, and snapshot files with the version of Hyper-V. 更新配置版本,会更改用于存储的虚拟机配置和检查点文件的文件结构。When you update the configuration version, you change the file structure that is used to store the virtual machines configuration and the checkpoint files. 你还可以为该 HYPER-V 主机支持的最新版本更新的配置版本。You also update the configuration version to the latest version supported by that Hyper-V host. 升级后的虚拟机使用新的配置文件格式,该文件格式旨在提高读取和写入虚拟机配置数据的效率。Upgraded virtual machines use a new configuration file format, which is designed to increase the efficiency of reading and writing virtual machine configuration data. 升级还减少了存储失败时数据损坏的可能性。The upgrade also reduces the potential for data corruption in the event of a storage failure.

下表列出了说明、 文件扩展名和用于新的或已升级虚拟机的文件的每种类型的默认位置。The following table lists descriptions, file name extensions, and default locations for each type of file that's used for new or upgraded virtual machines.

虚拟机的文件类型Virtual machine file types 描述Description
配置Configuration 以二进制文件格式存储的虚拟机配置信息。Virtual machine configuration information that is stored in binary file format.
文件扩展名:.vmcxFile name extension: .vmcx
默认位置:C:\ProgramData\Microsoft\Windows\Hyper-V\Virtual MachinesDefault location: C:\ProgramData\Microsoft\Windows\Hyper-V\Virtual Machines
运行时状态Runtime state 以二进制文件格式存储的虚拟机运行时状态信息。Virtual machine runtime state information that is stored in binary file format.
文件扩展名:.vmrs 和.vmgsFile name extension: .vmrs and .vmgs
默认位置:C:\ProgramData\Microsoft\Windows\Hyper-V\Virtual MachinesDefault location: C:\ProgramData\Microsoft\Windows\Hyper-V\Virtual Machines
虚拟硬盘Virtual hard disk 将存储虚拟机的虚拟硬盘。Stores virtual hard disks for the virtual machine.
文件扩展名:.vhd 或.vhdxFile name extension: .vhd or .vhdx
默认位置:C:\ProgramData\Microsoft\Windows\Hyper-V\Virtual Hard DisksDefault location: C:\ProgramData\Microsoft\Windows\Hyper-V\Virtual Hard Disks
自动虚拟硬盘Automatic virtual hard disk 用于虚拟机检查点的差异磁盘文件。Differencing disk files used for virtual machine checkpoints.
文件扩展名:.avhdxFile name extension: .avhdx
默认位置:C:\ProgramData\Microsoft\Windows\Hyper-V\Virtual Hard DisksDefault location: C:\ProgramData\Microsoft\Windows\Hyper-V\Virtual Hard Disks
CheckpointCheckpoint 检查点存储在多个检查点文件中。Checkpoints are stored in multiple checkpoint files. 每个检查点都会创建一个配置文件和运行时状态文件。Each checkpoint creates a configuration file and runtime state file.
文件扩展名:.vmrs 和.vmcxFile name extensions: .vmrs and .vmcx
默认位置:C:\ProgramData\Microsoft\Windows\SnapshotsDefault location: C:\ProgramData\Microsoft\Windows\Snapshots

如果不升级虚拟机配置版本,会发生什么情况?What happens if I don't upgrade the virtual machine configuration version?

如果你有使用早期版本的 HYPER-V 创建的虚拟机,一些功能,可更高版本的主机 OS 可能无法使用这些虚拟机更新的配置版本前上可用。If you have virtual machines that you created with an earlier version of Hyper-V, some features that are available on the newer host OS may not work with those virtual machines until you update the configuration version.

作为一般原则,我们建议更新的配置版本后已成功升级到较新版本的 Windows 虚拟化主机,并确信不需要回滚。As a general guidance, we recommend updating the configuration version once you have successfully upgraded the virtualization hosts to a newer version of Windows and feel confident that you do not need to roll back. 使用时群集操作系统滚动升级功能,则通常会在更新群集功能级别后。When you are using the cluster OS rolling upgrade feature, this would typically be after updating the cluster functional level. 这样一来,将从新特性和内部更改以及优化也获益。This way, you will benefit from new features and internal changes and optimizations as well.

备注

更新虚拟机配置版本之后, VM 将无法在不支持更新的配置版本的主机上启动。Once the VM configuration version is updated, the VM won't be able to start on hosts that do not support the updated configuration version.

下表显示了使用某些 HYPER-V 功能所需的最小虚拟机配置版本。The following table shows the minimum virtual machine configuration version required to use some Hyper-V features.

功能Feature 最小虚拟机配置版本Minimum VM configuration version
热添加/删除内存Hot Add/Remove Memory 6.26.2
Linux VM 的安全启动Secure Boot for Linux VMs 6.26.2
生产检查点Production Checkpoints 6.26.2
PowerShell DirectPowerShell Direct 6.26.2
虚拟机分组Virtual Machine Grouping 6.26.2
虚拟受信任的平台模块 (vTPM)Virtual Trusted Platform Module (vTPM) 7.07.0
虚拟机多队列 (VMMQ)Virtual machine multi queues (VMMQ) 7.17.1
XSAVE 支持XSAVE support 8.08.0
密钥存储驱动器Key storage drive 8.08.0
来宾基于虚拟化的安全性支持 (VBS)Guest virtualization-based security support (VBS) 8.08.0
嵌套虚拟化Nested virtualization 8.08.0
虚拟处理器计数Virtual processor count 8.08.0
较大内存的虚拟机Large memory VMs 8.08.0
增加到 64 每个设备 (例如网络和分配的设备) 的虚拟设备的默认最大数目Increase the default maximum number for virtual devices to 64 per device (e.g. networking and assigned devices) 8.38.3
Perfmon 允许额外的处理器功能Allow additional processor features for Perfmon 9.09.0
自动公开同时进行多线程处理使用的主机上运行的 Vm 的配置Core 计划程序Automatically expose simultaneous multithreading configuration for VMs running on hosts using the Core Scheduler 9.09.0
休眠支持Hibernation support 9.09.0

有关这些功能的详细信息,请参阅什么是 Windows Server 上的 HYPER-V 中的新增功能For more information about these features, see What's new in Hyper-V on Windows Server.