How To Use The WMI
Interfaces With Windows
Virtualization
Pierre Jacomet
Senior Program Manager
Windows Virtualization
Microsoft Corporation
Goals
After this presentation you will
Have a clear idea of Microsoft’s management
approach to virtualization services
Have a high level understanding on the
virtualization services WMI interface
Have a better idea of how you can integrate
your product with virtualization services
For managing purposes
To integrate your hardware
Agenda
Introduction
Computer systems
Management service
Resources and resource pools
Virtual system settings
Runtime instance of a VM
Snapshots
Code examples
Introduction To WMI
WMI – Windows Management Interface is
Microsoft’s implementation of DMTF WBEM
DMTF = Distributed Management Task Force
WBEM = Web Based Enterprise Management
Object oriented approach to systems
manageability
Uses DMTF CIM – Common Information Model
Microsoft is working in the DMTF
Defining virtualization management profile
WMI interface is subject to change
DMTF changes
Ongoing Microsoft development work
WMI Value Proposition
WMI is the interface that applications use to
manage all aspects of Windows virtualization
services
WMI is consumer agnostic
Can be accessed remotely by WS-Management,
Programmable via C++, WSH, .NET
Hardware manufacturers benefit from
understanding WMI
Understand how their hardware can participate
within overall Windows virtualization
services manageability
Introduction To CIM
Common Information Model
Object-oriented information model
Provides a conceptual framework for describing
management data
For computing and business entities
In Internet, enterprise and service provider environments
Formalism
UML – Universal Modeling Language
MOF – Managed Object Format
CIMOM – CIM object manager
Implements CIM
WMI includes a CIMOM component
CIM Schema
Schemas are building blocks of CIM
Describe and represent manageability
Core model
Capture notions applicable to all
management areas
Common models
Capture notions common to particular
management areas
Independent of any particular implementation
CIM
Common models
Apps
Database
Device
Event
Interop
Metrics
Network
Physical
Policy
Support
System
User
Virtualization
DMTF Management Profile
Specification that defines the CIM model
and associated behavior for a
management domain
Use small subset of full CIM schema
Within management domain defines
Classes, associations, etc.
Requirements regarding above classes
and associations
CIM Virtualization Profile
Specification that defines the CIM model
and behavior for virtualization
management domain
Depends on CIM core model
Core includes basic classes, associations,
indications, methods and properties
Implemented by Windows virtualization
WMI provider
CIM Virtualization Profile
General Design Approach
Model interoperable with other
virtualization platforms
Virtual resources modeled in the same
way as their physical counterparts
Virtual aspects abstracted into
associated classes
CIM Virtualization Profile
Note on name differences
Throughout this presentation please
note the following
Usage of word “Host” or “Physical” maps to
parent partition or the computer system
running in the parent partition
Main Virtualization Objects
Computer systems
Describe both physical and virtual computers
Management service
Controls all aspects of the lifecycle of a VM
Virtual system settings
Represent a VM or a snapshot
Resources and resource pools
Represent resources
Agenda
Introduction
Computer systems
Management service
Resources and resource pools
Virtual system settings
Runtime instance of a VM
Snapshots
Code examples
Computer Systems
Physical or virtual
VM is a computer system
Host is a computer system
CIM_ComputerSystem
(Physical)
CIM_ComputerSystem
(Virtual)
Computer Systems
Linking Physical to Virtual
Hosted Dependency association
links VM computer system to Host
computer system
Host
Computer System
Hosted Dependency
VM-1
Computer System
VM-2
Computer System
VM-3
Computer System
Computer Systems
Virtual Systems
All virtual aspects abstracted into a
virtualization specific object
Host
Computer System
Hosted Dependency
Virtual
Computer System
Element Setting Data
Virtual System
Setting Data
Virtual System Lifecycle
(Or possible states a VM can be in)
Defined
Initial state, resource usage described by
configuration, resources not allocated except for disks
Active
VM is running, all resources are allocated
Paused
VM is paused, all resources remain allocated
Suspended
VM resources are de-allocated, state is persisted
Virtual System
State transitions
Starting
state
VM defined
VM active
VM paused
VM suspended
End
state
Agenda
Introduction
Computer systems
Management service
Resources and resource pools
Virtual system settings
Runtime instance of a VM
Snapshots
Code examples
Management Service
Full name: Virtual System Management
Service (VSMS)
Central object in virtualization profile
Needed to access and manage virtualization
services exposed by a host system
Exposes operations to manage
VM lifecycle
Define virtual system
Modify virtual system
Request State Change
Others
Management Service
Relationship to host
VSMS is just another service
Scoped by Hosting computer system
Associated to host via Hosted Service
VSMS is special
Associated to host via Associated Virtual System
Management Service
Associated Virtual System Management Service
Virtual System
Management Service
Host
Computer System
Hosted Service
VSMS Discovering
Capabilities
Virtual System Management Capabilities class
describes VSMS implementation level
Optional methods
Indication support
Asynchronous operations support
Virtual System
Management Service
Element Capabilities
Virtual System
Management Capabilities
Agenda
Introduction
Computer systems
Management service
Resources and resource pools
Virtual system settings
Runtime instance of a VM
Snapshots
Code examples
Resources
Physical or virtual resources
have the same representation
Include items like
Memory
Network
Ports
Allocated from resource pools
Resource Pools
Managed by resource pool
configuration service
One allocated for a each device type
May be hierarchical
Central class for virtual device allocations
Virtual resources are allocated from
resource pools
Resource Pools
Resource pool configuration service
Host System
Hosted Service
Resource Pool
Configuration Capabilities
Resource Pool
Configuration Service
Element
Capabilities
Service Affects
Element
System Device
Hosted
Resource Pool
Host Resource
Resource Pool
Concrete
Component
Allocated From
Pool
Virtual Resource
Host Computer System
Instance diagram
Host has resources
Processor, memory
Host resources
go into pools
Host
Computer System
Hosted Resource Pool
Concrete Comp.
System
Device
Processor
Resource Pool
Processor
Memory
Resource Pool
Memory
NIC
Resource Pool
NIC
Agenda
WMI introduction
Computer systems
Management service
Resources and resource pools
Virtual system settings
Runtime instance of a VM
Snapshots
Code examples
Virtual System Settings
Virtual aspects of a Computer system
One instance for each different
configuration settings for a VM
Active state
Snapshots – 0 or more
Associated with resource allocation
settings for VM
Resource Allocation
Setting Data
Represents settings of a single resource
One instance for each different
device settings
Active
Snapshots – 0 or more
Virtual Computer System
Instance diagram
Element Setting Data
Virtual System Settings
(Active)
Virtual System Setting Data Component
Virtual
System has
virtual
devices
Virtual
system
settings and
Resource
allocation
settings track
allocations
Virtual
Computer System
Resource
Allocation
Setting
Resource
Allocation
Setting
Resource
Allocation
Setting
System
Device
Processor
Element Setting Data
Memory
NIC
Agenda
WMI introduction
Computer systems
Management service
Resources and resource pools
Virtual system settings
Runtime instance of a VM
Snapshots
Code examples
Running VM Instance
Diagram
Host
Computer System
Virtual
Computer System
Virtual System Settings
(Active)
Hosted Dependency
Resource
Allocation
Setting
Processor
Processor
Resource pool
Processor
Resource
Allocation
Setting
Memory
Memory
Resource pool
Memory
Resource
Allocation
Setting
NIC
NIC
Resource pool
NIC
Allocated from Pool
Agenda
Introduction
Computer systems
Management service
Resources and resource pools
Virtual system settings
Runtime instance of a VM
Snapshots
Code examples
Snapshots
Definition
Represents point in time configuration
of a VM including it’s resources
In CIM terms
A Virtual System Settings Data structure
All of the associated Resource Allocation
Setting Data elements
Snapshots Creation
Simplified instance diagram
Element Setting Data
Virtual
Computer System
Virtual System Settings
(Snapshot @ t-2)
Virtual System Settings
(Snapshot @ t-1)
Virtual System Settings
(Active)
Resource
Allocation
Setting
Resource
Allocation
Setting
Resource
Allocation
Setting
Processor
Resource
Allocation
Setting
Resource
Allocation
Setting
Resource
Allocation
Setting
Memory
Resource
Allocation
Setting
Resource
Allocation
Setting
Resource
Allocation
Setting
NIC
Applying A Snapshot
Client enumerates snapshots using
Element Setting Data aggregation
Selects snapshot that she/he wants
to apply
Invokes ApplySnapshot() method
of VSMS
Snapshot recorded values become
current values
Applying A Snapshot
Simplified instance diagram
Element Setting Data
Virtual
Computer System
Virtual System Settings
Snapshot@
(t-2)
(Snapshot
t-2)
Virtual System Settings
(Active)
Resource
Allocation
Setting
Resource
Allocation
Setting
Processor
Resource
Allocation
Setting
Resource
Allocation
Setting
Memory
Resource
Allocation
Setting
Resource
Allocation
Setting
Apply Snapshot
NIC
Agenda
Introduction
Computer systems
Management service
Resources and resource pools
Virtual system settings
Runtime instance of a VM
Snapshots
Code examples
Common Code Sequence
Locate Windows virtualization services
Connect to WMI CIMOM in
virtualization namespace
Connect to VSMS
Issue WQL – WMI Query Language to
Locate instances of classes
Subscribe to events
Connecting To VSMS
Dim WMIService
Dim VMHost
VMHost = ".“
‘ Connect to the CIMOM in the destination machine
‘ we use the \virtualization namespace.
Set WMIService = GetObject( "winmgmts:\\" & VMHost _
& "\root\Virtualization")
‘ Connect to WMI class that represents VSMS
Set VMService = WMIService.Get("Msvm_VirtualSystemManagementService")
Enumerate VMs
Dim
Dim
Dim
Dim
WMIService
VMList
VM
VMHost
VMHost = "."
' Get instance of the WMI Service in the virtualization namespace.
Set WMIService = GetObject("winmgmts:\\" & VMHost & _
"\root\virtualization")
' Enumerate all Msvm_VirtualComputerSystem objects.
Set VMList = WMIService.InstancesOf("Msvm_VirtualComputerSystem")
For Each VM In VMList
WScript.Echo "VM Name: " & VM.ElementName
Next
Activate A VM
Const wbemFlagForwardOnly
= 32
Const wbemFlagReturnImmediately = 16
Dim VMList
Dim VM
…
…
' Use a WQL query to Find the VM passed in as argument in VMName
Set VMList = WMIService.ExecQuery ( _
"SELECT * FROM Msvm_VirtualComputerSystem
"WHERE
"
& _
ElementName='" & VMName & "'",
"WQL", _
wbemFlagForwardOnly + wbemFlagReturnImmediately _
)
' Activate the specified VM.
For Each VM In VMList
WScript.Echo "Activating VM " & VM.Name
VMService.ActivateVirtualSystem (VM)
Next
Deactivate A VM
Const wbemFlagForwardOnly
= 32
Const wbemFlagReturnImmediately = 16
Dim VMList
Dim VM
…
…
' Use a WQL query to Find the VM passed in as argument in VMName
Set VMList = WMIService.ExecQuery ( _
"SELECT * FROM Msvm_VirtualComputerSystem
"WHERE
"
& _
ElementName='" & VMName & "'",
"WQL", _
wbemFlagForwardOnly + wbemFlagReturnImmediately _
)
' Deactivate the specified VM.
For Each VM In VMList
WScript.Echo “Deactivating VM " & VM.Name
VMService.DeActivateVirtualSystem (VM)
Next
Call To Action
If you are interested to have your software
or hardware product participate in
virtualized environment manageability
Stay in touch with our WMI interface
Engage in Beta program
Send feedback and questions
to MSVirtEx @ microsoft.com
Additional Resources
Related Sessions
BUS126 Windows Virtualization Strategy and Roadmap
VIR065 Microsoft Operating System Virtualization Strategy
and Virtual Hard Disk Directions
VIR047 Hypervisor, Virtualization Stack,
and Device Virtualization Architectures
VIR040 Device Virtualization Architecture
VIR043 How to Use WMI Interfaces with Windows Virtualization
VIR049 Inside Microsoft’s Network and Storage VSP/VSC
VIR124 Windows Virtualization Best Practices
and Future Hardware Directions
VIR046 Hypercall APIs Explained
Additional Resources
Publications and Contact Information
Publications
Presentations and future papers
http://www.microsoft.com/whdc/system/platform/virtual/default.mspx
Preview papers and specs
WinHEC Proceedings DVD
Windows Hypervisor Top Level Functional Specification
Windows Virtualization Glossary
Web resources
Windows Virtualization Team Blog
http://blogs.technet.com/virtualization
AMD I/O Virtualization Technology (IOMMU) Specification
http://developer.amd.com/documentation.aspx
Intel® Virtualization Technology for Directed I/O Architecture Specification
ftp://download.intel.com/technology/computing/vptech/Intel(r)_VT_for_Direct_IO.pdf
LaGrande Technology Preliminary Architecture Specification
http://www.intel.com/technology/security/
Trusted Computing Group
http://www.trustedcomputinggroup.org/home
Email comments to msvirtex @ microsoft.com
© 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market
conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.
MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
© Copyright 2026 Paperzz