GetSummaryInformation method of the Msvm_VirtualSystemManagementService class

Returns virtual machine summary information.

Syntax


uint32 GetSummaryInformation(
  [in]  CIM_VirtualSystemSettingData REF SettingData[],
  [in]  uint32                           RequestedInformation[],
  [out] Msvm_SummaryInformation          SummaryInformation[]
);

Parameters

SettingData [in]

Type: CIM_VirtualSystemSettingData[]

An array of CIM_VirtualSystemSettingData instances that specify the virtual machines or snapshots for which information is to be retrieved. If this parameter is Null, information for all virtual machines is retrieved.

RequestedInformation [in]

Type: uint32[]

An array of enumeration values, which correspond to the properties in the Msvm_SummaryInformation class, that specify the data to retrieve for the virtual machines and snapshots specified in the SettingData array.

ValueMeaning
Name
0

This corresponds to the Name property of the Msvm_SummaryInformation class.

Element Name
1

This corresponds to the ElementName property of the Msvm_SummaryInformation class.

Creation Time
2

This corresponds to the CreationTime property of the Msvm_SummaryInformation class.

Notes
3

This corresponds to the Notes property of the Msvm_SummaryInformation class.

Number of Processors
4

This corresponds to the NumberOfProcessors property of the Msvm_SummaryInformation class.

Small ThumbnailImage (80x60)
5

This corresponds to the ThumbnailImage property of the Msvm_SummaryInformation class. A thumbnail image with the dimensions of 80×60 will be retrieved.

Medium ThumbnailImage (160x120)
6

This corresponds to the ThumbnailImage property of the Msvm_SummaryInformation class. A thumbnail image with the dimensions of 160×120 will be retrieved.

Large ThumbnailImage (320x240)
7

This corresponds to the ThumbnailImage property of the Msvm_SummaryInformation class. A thumbnail image with the dimensions of 320×240 will be retrieved.

AllocatedGPU
8

This corresponds to the AllocatedGPU property of the Msvm_SummaryInformation class.

EnabledState
100

This corresponds to the EnabledState property of the Msvm_SummaryInformation class.

ProcessorLoad
101

This corresponds to the ProcessorLoad property of the Msvm_SummaryInformation class.

ProcessorLoadHistory
102

This corresponds to the ProcessorLoadHistory property of the Msvm_SummaryInformation class.

MemoryUsage
103

This corresponds to the MemoryUsage property of the Msvm_SummaryInformation class.

Heartbeat
104

This corresponds to the Heartbeat property of the Msvm_SummaryInformation class.

Uptime
105

This corresponds to the UpTime property of the Msvm_SummaryInformation class.

GuestOperatingSystem
106

This corresponds to the GuestOperatingSystem property of the Msvm_SummaryInformation class.

Snapshots
107

This corresponds to the Snapshots property of the Msvm_SummaryInformation class.

AsynchronousTasks
108

This corresponds to the AsynchronousTasks property of the Msvm_SummaryInformation class.

HealthState
109

This corresponds to the HealthState property of the Msvm_SummaryInformation class.

OperationalStatus
110

This corresponds to the OperationalStatus property of the Msvm_SummaryInformation class.

StatusDescriptions
111

This corresponds to the StatusDescriptions property of the Msvm_SummaryInformation class.

MemoryAvailable
112

This corresponds to the MemoryAvailable property of the Msvm_SummaryInformation class.

AvailableMemoryBuffer
113

This corresponds to the AvailableMemoryBuffer property of the Msvm_SummaryInformation class.

ReplicationMode
114

This corresponds to the ReplicationMode property of the Msvm_SummaryInformation class.

ReplicationState
115

This corresponds to the ReplicationState property of the Msvm_SummaryInformation class.

ReplicationHealth
116

This corresponds to the ReplicationHealth property of the Msvm_SummaryInformation class.

TestReplicaSystem
117

This corresponds to the TestReplicaSystem property of the Msvm_SummaryInformation class.

ReplicationStateEx
118

This corresponds to the ReplicationState property of the Msvm_ReplicationRelationship class. This is array for all replication state values across primary and extended relationship. 0 index value is always for primary relationship, and if extended replication is enabled, it is returned in index 1.

ReplicationHealthEx
119

This corresponds to the ReplicationHealth property of the Msvm_ReplicationRelationship class. This is array for all replication health values across primary and extended relationship. 0 index value is always for primary relationship, and if extended replication is enabled, it is returned in index 1.

ApplicationHealth
120

This corresponds to the ApplicationHealth property of the Msvm_SummaryInformation class.

SwapFilesInUse
121

This corresponds to the SwapFilesInUse property of the Msvm_SummaryInformation class.

ReplicationProviderId
122

This corresponds to the Name property of the Msvm_ReplicationProvider class.

IntegrationServicesVersionState
123

This corresponds to the IntegrationServicesVersionState property of the Msvm_SummaryInformation class.

IntegrationServicesVersionState
132

This corresponds to the IntegrationServicesVersionState property of the Msvm_SummaryInformation class.

OtherEnabledState
133

This corresponds to the OtherEnabledState property of the Msvm_SummaryInformation class.

 

SummaryInformation [out]

Type: Msvm_SummaryInformation[]

An array of Msvm_SummaryInformation instances containing the requested information for the virtual machines and/or snapshots specified in the SettingData array. This array will have the same number of elements as the SettingData array. Each of these entries will contain the Name property, even if this property was not requested. If the virtual machine or snapshot cannot be found or is unavailable, the Name property of the corresponding summary information entry will be empty.

Properties not specified in the RequestedInformation parameter will have a Null value.

Return value

Type: uint32

This method returns one of the following values.

Completed with No Error (0)
Failed (32768)
Access Denied (32769)
Invalid parameter (32773)
Out of memory (32778)

Remarks

Access to the Msvm_VirtualSystemManagementService class might be restricted by UAC Filtering. For more information, see User Account Control and WMI.

Examples

The following C# sample displays summary information. The referenced utilities can be found in Common utilities for the virtualization samples (V2).

Important  To function correctly, the following code must be run on the virtual machine host server, and must be run with Administrator privileges.
 

public class GetSummaryInformationClassV2
{
    public static void GetSummaryInformation(string[] vmNames)
    {
        ManagementScope scope = new ManagementScope(@"root\virtualization\v2", null);
        ManagementObject virtualSystemService = Utility.GetServiceObject(scope, "Msvm_VirtualSystemManagementService");
        ManagementBaseObject inParams = virtualSystemService.GetMethodParameters("GetSummaryInformation");

        ManagementObject[] virtualSystemSettings = new ManagementObject[vmNames.Length];

        for (int i = 0; i < vmNames.Length; i++)
        {
            virtualSystemSettings[i] = GetVirtualSystemSetting(vmNames[i], scope);
        }

        UInt32[] requestedInformation = new UInt32[4];
        requestedInformation[0] = 1;    // ElementName
        requestedInformation[2] = 103;  // MemoryUsage
        requestedInformation[3] = 112;  // MemoryAvailable

        inParams["SettingData"] = virtualSystemSettings;
        inParams["RequestedInformation"] = requestedInformation;

        ManagementBaseObject outParams = virtualSystemService.InvokeMethod("GetSummaryInformation", inParams, null);

        if ((UInt32)outParams["ReturnValue"] == ReturnCode.Completed)
        {
            Console.WriteLine("Summary information was retrieved successfully.");

            ManagementBaseObject[] summaryInformationArray = 
                (ManagementBaseObject[])outParams["SummaryInformation"];

            foreach (ManagementBaseObject summaryInformation in summaryInformationArray)
            {
                Console.WriteLine("\nVirtual System Summary Information:");
                if ((null == summaryInformation["Name"]) || 
                    (summaryInformation["Name"].ToString().Length == 0))
                {
                    Console.WriteLine("\tThe VM or snapshot could not be found.");
                }
                else
                {
                    Console.WriteLine("\tName: {0}", summaryInformation["Name"].ToString());
                    foreach (UInt32 requested in requestedInformation)
                    {
                        switch (requested)
                        {
                            case 1:
                                Console.WriteLine("\tElementName: {0}", summaryInformation["ElementName"].ToString());
                                break;

                            case 103:
                                Console.WriteLine("\tMemoryUsage: {0}", summaryInformation["MemoryUsage"].ToString());
                                break;

                            case 112:
                                Console.WriteLine("\tMemoryAvailable: {0}", summaryInformation["MemoryAvailable"].ToString());
                                break;
                        }
                    }
                }
            }
        }
        else
        {
            Console.WriteLine("Failed to retrieve virtual system summary information");
        }

        inParams.Dispose();
        outParams.Dispose();
        virtualSystemService.Dispose();
    }

    public static ManagementObject GetVirtualSystemSetting(string vmName, ManagementScope scope)
    {
        ManagementObject virtualSystem = Utility.GetTargetComputer(vmName, scope);

        ManagementObjectCollection virtualSystemSettings = virtualSystem.GetRelated
         (
             "Msvm_VirtualSystemSettingData",
             "Msvm_SettingsDefineState",
             null,
             null,
             "SettingData",
             "ManagedElement",
             false,
             null
         );

        ManagementObject virtualSystemSetting = null;

        foreach (ManagementObject instance in virtualSystemSettings)
        {
            virtualSystemSetting = instance;
            break;
        }

        return virtualSystemSetting;

    }
}


Requirements

Minimum supported client

Windows 8 [desktop apps only]

Minimum supported server

Windows Server 2012 [desktop apps only]

Namespace

Root\Virtualization\V2

MOF

WindowsVirtualization.V2.mof

See also

Msvm_VirtualSystemManagementService
CIM_VirtualSystemSettingData
Msvm_SummaryInformation

 

 

Community Additions

ADD
Show: