Click to Rate and Give Feedback
MSDN
MSDN Library
Hyper-V
Msvm_ComputerSystem
Msvm_ComputerSystem Class

Represents a hosting computer system or virtual computer system.

To retrieve information for the VMMS, use Msvm_VirtualSystemManagementService.

The following syntax is simplified Managed Object Format (MOF) code, and it includes all of the inherited properties.

Syntax


class Msvm_ComputerSystem : CIM_ComputerSystem
{
  string Caption;
  string Description;
  string ElementName;
  datetime InstallDate;
  uint16 OperationalStatus[];
  string StatusDescriptions[];
  string Status;
  uint16 HealthState;
  string EnabledState;
  string OtherEnabledState;
  uint16 RequestedState;
  uint16 EnabledDefault = 2;
  datetime TimeOfLastStateChange;
  string CreationClassName;
  string Name;
  string PrimaryOwnerName;
  string PrimaryOwnerContact;
  string Roles[];
  string NameFormat;
  string OtherIdentifyingInfo[];
  string IdentifyingDescriptions[];
  uint16 Dedicated[];
  string OtherDedicatedDescriptions[];
  uint16 ResetCapability;
  uint16 PowerManagementCapabilities[];
  uint64 OnTimeInMilliseconds;
  datetime TimeOfLastConfigurationChange;
  uint32 ProcessID;
  uint16 AssignedNumaNodeList[];
};

Methods

The Msvm_ComputerSystem class defines the following methods.

MethodDescription

SetPowerState

This method is not supported.

RequestStateChange

Requests that the state of the computer system be changed. This method is only valid for instances of Msvm_ComputerSystem that represent a virtual computer system.

Properties

The Msvm_ComputerSystem class defines the following properties.

AssignedNumaNodeList
Data type: uint16 array
Access type: Read-only

An array of NUMA nodes that are currently assigned to the virtual machine.

Caption
Data type: string
Access type: Read-only

A short textual description (one-line string) of the object. This property is inherited from CIM_ManagedElement and it is set to "Virtual Machine" if the instance represents a virtual machine or "Hosting Computer System" if the instance represents the host system.

CreationClassName
Data type: string
Access type: Read-only

The name of the class or subclass that is used in the creation of an instance. This property is inherited from CIM_System and it is set to "Msvm_ComputerSystem".

Dedicated
Data type: uint16 array
Access type: Read-only

Indicates whether the computer system is a special-purpose system (dedicated to a particular use), versus being a general-purpose system. This property is inherited from CIM_ComputerSystem and it is set to 0 ("Not Dedicated").

Description
Data type: string
Access type: Read-only

A textual description of the object. This property is inherited from CIM_ManagedElement and it is set to "Microsoft Virtual Computer System" if the instance represents a virtual system or "Microsoft Hosting Computer System" if the instance represents the host system.

ElementName
Data type: string
Access type: Read-only

A user-friendly name for the object. This property is inherited from CIM_ManagedElement and it is set to the display name of the computer for a virtual system or the NetBIOS name of the host system.

EnabledDefault
Data type: uint16
Access type: Read-only

An administrator's default or startup configuration for the enabled state of an element. This property is inherited from CIM_EnabledLogicalElement and it is always set to 2 ("Enabled").

EnabledState
Data type: string
Access type: Read-only

The enabled and disabled states of an element. It can also indicate the transitions between these requested states. This property is inherited from CIM_EnabledLogicalElement and it is set to 2 ("Enabled") for a host system or one of the following values for a virtual system.

NameValue

Unknown

0

Enabled

2

Disabled

3

Paused

32768

Suspended

32769

Starting

32770

Snapshotting

32771

Migrating

32772

Saving

32773

Stopping

32774

Deleted

32775

Pausing

32776

Resuming

32777

HealthState
Data type: uint16
Access type: Read-only

The current health of the element. This attribute expresses the health of this element but not necessarily that of its subcomponents. The possible values are 5 and 25, where 5 means the element is entirely healthy and 25 means there is a critical error.

When a critical error occurs, check the event log for details. The EnabledState property can also contain more information. For example, when disk space is critically low, HealthState is set to 25, the VM pauses, and EnabledState is set to 32768 ("Paused").

This property is inherited from CIM_ManagedSystemElement.

IdentifyingDescriptions
Data type: string array
Access type: Read-only

This property is inherited from CIM_ComputerSystem and it is set to NULL.

InstallDate
Data type: datetime
Access type: Read-only

The date and time the virtual machine configuration was created for a virtual system or NULL for a host system. This property is inherited from CIM_ManagedSystemElement.

Name
Data type: string
Access type: Read-only

The label by which the object is known. This property is inherited from CIM_System and it is a GUID.

NameFormat
Data type: string
Access type: Read-only

A string that identifies how the system name was generated, using the subclass heuristic. This property is inherited from CIM_ComputerSystem and it is set to NULL.

OnTimeInMilliseconds
Data type: uint64
Access type: Read-only

For the virtual system, this property describes the total up time, in milliseconds, since the machine was last turned on, reset, or restored. This time excludes the time the virtual system was in the paused state. For the host system, this property is set to NULL.

OperationalStatus
Data type: uint16 array
Access type: Read-only

The current statuses of the object. This property is inherited from CIM_ManagedSystemElement.

ValueMeaning

2

OK

10

Stopped

11

In Service

15

Dormant

OtherDedicatedDescriptions
Data type: string array
Access type: Read-only

A string that describes how or why the system is dedicated when the Dedicated array includes the value 2 ("Other"). This property is inherited from CIM_ComputerSystem and it is set to NULL.

OtherEnabledState
Data type: string
Access type: Read-only

The enabled or disabled state of the element when the EnabledState property is set to 1 ("Other"). This property must be set to null when EnabledState is any value other than 1. This property is inherited from CIM_EnabledLogicalElement and it is always set to NULL.

OtherIdentifyingInfo
Data type: string array
Access type: Read-only

This property is inherited from CIM_ComputerSystem and it is set to NULL.

PowerManagementCapabilities
Data type: uint16 array
Access type: Read-only

This property is inherited from CIM_ComputerSystem but it is not used.

PrimaryOwnerContact
Data type: string
Access type: Read-only

A string that indicates how the primary system owner can be reached (for example, a phone number or an e-mail address). This property is inherited from CIM_System and it is set to NULL.

PrimaryOwnerName
Data type: string
Access type: Read-only

The name of the primary system owner. This property is inherited from CIM_System and it is set to NULL.

ProcessID
Data type: uint32
Access type: Read-only

The identifier of the process under which this virtual machine is running. This value can be used to uniquely identify the instance of Vmwp.exe on the system that is running the virtual machine.

RequestedState
Data type: uint16
Access type: Read-only

The last requested or desired state for the element. The actual state of the element is represented by EnabledState. This property is provided to compare the last requested and current enabled or disabled states. This property is inherited from CIM_EnabledLogicalElement.

ResetCapability
Data type: uint16
Access type: Read-only

This property is inherited from CIM_ComputerSystem and it is set to 1 ("Other").

Roles
Data type: string array
Access type: Read-only

An array of strings that describe the roles the system plays in the information technology environment. This property is inherited from CIM_System and it is set to NULL.

Status
Data type: string
Access type: Read-only

This property is inherited from CIM_ManagedSystemElement but it is not used.

StatusDescriptions
Data type: string array
Access type: Read-only

Strings that describes the various OperationalStatus array values. This property is inherited from CIM_ManagedSystemElement and each array element is set to one of the following values.

NameValue

OK

2

Stopped

10

In Service

11

Dormant

15

TimeOfLastConfigurationChange
Data type: datetime
Access type: Read-only

The date and time when the virtual machine configuration file was last modified. The configuration file is modifed during certain virtual machine operations, as well as when any of the virtual machine or device settings are added, modified, or removed.

TimeOfLastStateChange
Data type: datetime
Access type: Read-only

The date or time when the enabled state of the element last changed. This property is inherited from CIM_EnabledLogicalElement.

Requirements

MOFWindowsVirtualization.mof
Namespace\\.\Root\Virtualization

See Also

CIM_ComputerSystem
Virtual System Classes


Send comments about this topic to Microsoft

Build date: 10/23/2008

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Get list of VMs on a host using WMI and PowerShell      Thomas Lee   |   Edit   |  
# get-vm.ps1
# Gets a list of all VMs running on this system
# Thomas Lee - tfl@psp.co.uk

# Get list from WMI
$vmbase = get-wmiobject Msvm_ComputerSystem -namespace root\virtualization

# Get hosting computer System Name

$HostName = $vmbase | ? {$_.Caption -eq "Hosting Computer System"} | select name

# print results
"{0} Virtual Machines on: {1} are:" -f $($vmbase.count-1),$Hostname.name

foreach ($vm in $vmbase) {
if ($vm.caption -ne "Hosting Computer System") {$vm.elementname}
}

This script produces the following output:

  

PS C:\Users\tfl> . 'C:\Users\tfl\AppData\Local\Temp\Untitled1.ps1'
3 Virtual Machines on: COOKHAM8 are:
Parent
Rebecca
Ubuntu-Root2

PS C:\Users\tfl>

Class available on Parent only      Thomas Lee   |   Edit   |  
To clarify - this class is found on the Parent, not on the guest VM.
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker