Set Virtual Machine State operation


The Set Virtual Machine State operation changes the existing state of a virtual machine (VM). This topic illustrates the actor adapter request and response and describes the elements used in the request.

The following table describes the elements for the adapter request:

 Adapter request elements for the Set Virtual Machine State operation

The following figure shows a sample <items> XML element for the Set Virtual Machine State operation:

Sample <items> XML element for the Set Virtual Machine State operation



<items>
  <item>
  <target>
<host>10.111.8.222</host>
<user-name>administrator</user-name>
       <password   encryption-type="Base64">pwd</password>   
<timeout-secs>120</timeout-secs>
 </target>
  <vm>Win2003</vm>
 <vm-guid><vm-guid>
<state>stopped</state>
</item>
<item>
  <target>
 <host>pw-mmm-abc-dv00</host>
 <user-name>administrator</user-name>
         <password>pwd</password>   
  </target>
  <vm>vw-pun-bpa-dv04</vm>
 <state>paused</state>
</item>
<item>
   <vm>Win2003</vm>
  <state>running</state>
</item>
<item>
 <target>Config1</target>
 <vm>Win2003</vm>
 <state>suspended</state>
</item>
</items> 

The following figure shows a sample adapter request for the Set Virtual Machine State operation:

Sample adapter request for the Set Virtual Machine State operation

<ms-hyperv-request>
   <operation-name>set-virtual-machine-state</operation-name>
   <arguments>
     <target>
       <host>10.111.8.222</host>
       <user-name>administrator</user-name>
       <password encryption-type="Base64">pwd</password>
       <timeout-secs>120</timeout-secs>
     </target>
     <vm>Win2003</vm>
     <vm-guid />
     <state>stopped</state>
   </arguments>
   <arguments>
     <target>
       <host>pw-mmm-abc-dv00</host>
       <user-name>administrator</user-name>
       <password>pwd</password>
     </target>
     <vm>vw-pun-abc-dv04</vm>
     <state>paused</state>
   </arguments>
   <arguments>
     <vm>Win2003</vm>
     <state>running</state>
   </arguments>
   <arguments>
     <target>Config1</target>
     <vm>Win2003</vm>
     <state>suspended</state>
   </arguments>
</ms-hyperv-request> 

The following figure shows a sample adapter response for the Set Virtual Machine State operation:

Sample adapter response for the Set Virtual Machine State operation

 


<ms-hyperv-response>
 <metadata>
   <status>success</status>
   <response-count>4</response-count>
 </metadata>
 <responses>
   <SetVirtualMachineStateResponse>
     <metadata>
       <target>10.111.8.222</target>
       <status>success</status>
       <count>1</count>
     </metadata>
     <items>
       <item>
         <vm-element-name>Win2003</vm-element-name>
         <genus>2</genus>
         <class>Msvm_ComputerSystem</class>
         <superclass>CIM_ComputerSystem</superclass>
         <dynasty>CIM_ManagedElement</dynasty>
         <relpath>Msvm_ComputerSystem.CreationClassName="Msvm_Com</relpath>
         <property-count>29</property-count>
         <derivation>{CIM_ComputerSystem, CIM_System, CIM_EnabledLog</derivation>
         <server>pw-mmm-abc-dv00</server>
         <namespace>root\virtualization</namespace>
         <path>\\pw-mmm-abc-dv00\root\virtualization:Msvm_Comp</path>
         <assigned-numa-node-list>{1}</assigned-numa-node-list>
         <caption>Virtual Machine</caption>
         <creation-class-name>Msvm_ComputerSystem</creation-class-name>
         <dedicated></dedicated>
         <description>Microsoft Virtual Machine</description>
         <element-name>Win2003</element-name>
         <enabled-default>2</enabled-default>
         <state>Running</state>
         <health-state>5</health-state>
         <identifying-descriptions></identifying-descriptions>
         <install-date>20120220093808.000000-000</install-date>
         <name>8677942E-BDAB-4001-BE6A-9B7950FD47A4</name>
         <name-format></name-format>
         <on-time-in-milliseconds>26738</on-time-in-milliseconds>
         <operational-status>{2}</operational-status>
         <other-dedicated-descriptions></other-dedicated-descriptions>
         <other-enabled-state></other-enabled-state>
         <other-identifying-info></other-identifying-info>
         <power-management-capabilities></power-management-capabilities>
         <primary-owner-contact></primary-owner-contact>
         <primary-owner-name></primary-owner-name>
         <process-i-d>5564</process-i-d>
         <requested-state>Not Applicable</requested-state>
         <reset-capability>1</reset-capability>
         <roles></roles>
         <status></status>
         <status-descriptions>{Operating normally}</status-descriptions>
         <time-of-last-configuration-change>20120312104359.082383-000</time-of-last-configuration-change>
         <time-of-last-state-change>20120312104359.000000-000</time-of-last-state-change>
       </item>
     </items>
   </SetVirtualMachineStateResponse>
   <SetVirtualMachineStateResponse>
     <metadata>
       <target>pw-mmm-abc-dv00</target>
       <status>success</status>
       <count>1</count>
     </metadata>
     <items>
       <item>
         <vm-element-name>vw-pun-bpa-dv04</vm-element-name>
         <genus>2</genus>
         <class>Msvm_ComputerSystem</class>
         <superclass>CIM_ComputerSystem</superclass>
         <dynasty>CIM_ManagedElement</dynasty>
         <relpath>Msvm_ComputerSystem.CreationClassName="Msvm_Com</relpath>
         <property-count>29</property-count>
         <derivation>{CIM_ComputerSystem, CIM_System, CIM_EnabledLog</derivation>
         <server>pw-mmm-abc-dv00</server>
         <namespace>root\virtualization</namespace>
         <path>\\pw-mmm-abc-dv00\root\virtualization:Msvm_Comp</path>
         <assigned-numa-node-list>{1}</assigned-numa-node-list>
         <caption>Virtual Machine</caption>
         <creation-class-name>Msvm_ComputerSystem</creation-class-name>
         <dedicated></dedicated>
         <description>Microsoft Virtual Machine</description>
         <element-name>vw-pun-bpa-dv04</element-name>
         <enabled-default>2</enabled-default>
         <state>Running</state>
         <health-state>5</health-state>
         <identifying-descriptions></identifying-descriptions>
         <install-date>20120308055715.000000-000</install-date>
         <name>5EB9769F-F25A-4D7B-B8DD-ECCE57FF9CDC</name>
         <name-format></name-format>
         <on-time-in-milliseconds>341850046</on-time-in-milliseconds>
         <operational-status>{2}</operational-status>
         <other-dedicated-descriptions></other-dedicated-descriptions>
         <other-enabled-state></other-enabled-state>
         <other-identifying-info></other-identifying-info>
         <power-management-capabilities></power-management-capabilities>
         <primary-owner-contact></primary-owner-contact>
         <primary-owner-name></primary-owner-name>
         <process-i-d>5872</process-i-d>
         <requested-state>Not Applicable</requested-state>
         <reset-capability>1</reset-capability>
         <roles></roles>
         <status></status>
         <status-descriptions>{Operating normally}</status-descriptions>
         <time-of-last-configuration-change>20120312104315.917108-000</time-of-last-configuration-change>
         <time-of-last-state-change>20120312104315.000000-000</time-of-last-state-change>
       </item>
     </items>
   </SetVirtualMachineStateResponse>
   <SetVirtualMachineStateResponse>
     <metadata>
       <target>10.111.8.222</target>
       <status>success</status>
       <count>1</count>
     </metadata>
     <items>
       <item>
         <vm-element-name>Win2003</vm-element-name>
         <genus>2</genus>
         <class>Msvm_ComputerSystem</class>
         <superclass>CIM_ComputerSystem</superclass>
         <dynasty>CIM_ManagedElement</dynasty>
         <relpath>Msvm_ComputerSystem.CreationClassName="Msvm_Com</relpath>
         <property-count>29</property-count>
         <derivation>{CIM_ComputerSystem, CIM_System, CIM_EnabledLog</derivation>
         <server>pw-mmm-abc-dv00</server>
         <namespace>root\virtualization</namespace>
         <path>\\pw-mmm-abc-dv00\root\virtualization:Msvm_Comp</path>
         <assigned-numa-node-list>{}</assigned-numa-node-list>
         <caption>Virtual Machine</caption>
         <creation-class-name>Msvm_ComputerSystem</creation-class-name>
         <dedicated></dedicated>
         <description>Microsoft Virtual Machine</description>
         <element-name>Win2003</element-name>
         <enabled-default>2</enabled-default>
         <state>Stopped</state>
         <health-state>5</health-state>
         <identifying-descriptions></identifying-descriptions>
         <install-date>20120220093808.000000-000</install-date>
         <name>8677942E-BDAB-4001-BE6A-9B7950FD47A4</name>
         <name-format></name-format>
         <on-time-in-milliseconds>0</on-time-in-milliseconds>
         <operational-status>{2}</operational-status>
         <other-dedicated-descriptions></other-dedicated-descriptions>
         <other-enabled-state></other-enabled-state>
         <other-identifying-info></other-identifying-info>
         <power-management-capabilities></power-management-capabilities>
         <primary-owner-contact></primary-owner-contact>
         <primary-owner-name></primary-owner-name>
         <process-i-d>0</process-i-d>
         <requested-state>Not Applicable</requested-state>
         <reset-capability>1</reset-capability>
         <roles></roles>
         <status></status>
         <status-descriptions>{Operating normally}</status-descriptions>
         <time-of-last-configuration-change>20120312104428.129634-000</time-of-last-configuration-change>
         <time-of-last-state-change>20120312104428.000000-000</time-of-last-state-change>
       </item>
     </items>
   </SetVirtualMachineStateResponse>
   <SetVirtualMachineStateResponse>
     <metadata>
       <target>pw-mmm-abc-dv00</target>
       <status>success</status>
       <count>1</count>
     </metadata>
     <items>
       <item>
         <vm-element-name>Win2003</vm-element-name>
         <genus>2</genus>
         <class>Msvm_ComputerSystem</class>
         <superclass>CIM_ComputerSystem</superclass>
         <dynasty>CIM_ManagedElement</dynasty>
         <relpath>Msvm_ComputerSystem.CreationClassName="Msvm_Com</relpath>
         <property-count>29</property-count>
         <derivation>{CIM_ComputerSystem, CIM_System, CIM_EnabledLog</derivation>
         <server>pw-mmm-abc-dv00</server>
         <namespace>root\virtualization</namespace>
         <path>\\pw-mmm-abc-dv00\root\virtualization:Msvm_Comp</path>
         <assigned-numa-node-list>{1}</assigned-numa-node-list>
         <caption>Virtual Machine</caption>
         <creation-class-name>Msvm_ComputerSystem</creation-class-name>
         <dedicated></dedicated>
         <description>Microsoft Virtual Machine</description>
         <element-name>Win2003</element-name>
         <enabled-default>2</enabled-default>
         <state>Running</state>
         <health-state>5</health-state>
         <identifying-descriptions></identifying-descriptions>
         <install-date>20120220093808.000000-000</install-date>
         <name>8677942E-BDAB-4001-BE6A-9B7950FD47A4</name>
         <name-format></name-format>
         <on-time-in-milliseconds>3057</on-time-in-milliseconds>
         <operational-status>{2}</operational-status>
         <other-dedicated-descriptions></other-dedicated-descriptions>
         <other-enabled-state></other-enabled-state>
         <other-identifying-info></other-identifying-info>
         <power-management-capabilities></power-management-capabilities>
         <primary-owner-contact></primary-owner-contact>
         <primary-owner-name></primary-owner-name>
         <process-i-d>3748</process-i-d>
         <requested-state>Not Applicable</requested-state>
         <reset-capability>1</reset-capability>
         <roles></roles>
         <status></status>
         <status-descriptions>{Operating normally}</status-descriptions>
         <time-of-last-configuration-change>20120312104437.942052-000</time-of-last-configuration-change>
         <time-of-last-state-change>20120312104437.000000-000</time-of-last-state-change>
       </item>
     </items>
   </SetVirtualMachineStateResponse>
 </responses>
</ms-hyperv-response> 

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*