大网数据广告活动
Hyper-V与虚拟化

Move from Hyper-V WMI v1 to WMI v2

· 52CE 我爱测

Learn how to move from Hyper-V WMI v1 to WMI v2.

Windows Management Instrumentation (WMI) is the management interface underlying Hyper-V Manager and Hyper-V's PowerShell cmdlets. While most people use our PowerShell cmdlets or Hyper-V manager, sometimes developers needed WMI directly.

There have been two Hyper-V WMI namespaces (or versions of the Hyper-V WMI API).

  • The WMI v1 namespace (root\virtualization) which was introduced in Windows Server 2008 and last available in Windows Server 2012
  • The WMI v2 namespace (root\virtualization\v2) which was introduced in Windows Server 2012

This document contains references to resources for converting code that talks to our old WMI namespace to the new one. Initially, this article will serve as a repository for API information and sample code / scripts that can be used to help port any programs or scripts that use Hyper-V WMI APIs from the v1 namespace to the v2 namespace.

MSDN Samples

Hyper-V virtual machine migration sample
Hyper-V virtual Fiber Channel sample
Hyper-V planned virtual machines sample
Hyper-V application health monitoring sample
Virtual hard disk management sample
Hyper-V replication sample
Hyper-V metrics sample
Hyper-V dynamic memory sample
Hyper-V Extensible Switch extension filter driver
Hyper-V networking sample
Hyper-V resource pool management sample
Hyper-V recovery snapshot sample

Samples From Blogs

Adding a Network Adapter To A VM Using The Hyper-V WMI V2 Namespace
Connecting a VM Network Adapter To A Switch Using The Hyper-V WMI V2 Namespace
Changing The MAC Address Of NIC Using The Hyper-V WMI V2 Namespace
Removing a Network Adapter To A VM Using The Hyper-V WMI V2 Namespace
Attaching a VHD To A VM Using The Hyper-V WMI V2 Namespace
Removing a VHD From A VM Using The Hyper-V WMI V2 Namespace
Creating a VM using the Hyper-V WMI V2 Namespace

Source: Microsoft Learn / Windows Server documentation by Microsoft and contributors (upstream author metadata: robinharwood). Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Server documentation
适用范围
Windows Server · Source date 04/13/2017
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。