Virtualization - executeCommand


 Virtualization - executeCommand

Description :

This command updates various settings for an existing powered-off virtual machine, based on an XML file. The XML file contains the settings and their values with which you want to update the virtual machine.  

You can use this command to edit various settings such as:

  • Add/Enable/Remove Hot CPU
  • Add/Enable/Remove Hot Mem
  • Mount bootdisk to CDROM
  • BootOrder Nic
  • BootOrder Disk
  • BootOrder CDROM
  • Update the CPU/Mem size

Prerequisite:

The virtual machine must be powered off

  • Update the XML file for the virtual machine name and settings with which you want to update the virtual machine. 

    Click here to see a sample XML file, VMConfigurationInfo.xml, which updates a virtual machine, windows-vm

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <command>
      <method>reconfigVM_Task</method>
      <params>
        <param>
          <MOR>
            <Type>VirtualMachine</Type>
            <Name>windows-vm</Name>
          </MOR>
        </param>
        <param>
          <com.vmware.vim25.VirtualMachineConfigSpec>
            <cpuHotAddEnabled>
              <java.lang.Boolean>true</java.lang.Boolean>
            </cpuHotAddEnabled>
                    <numCPUs>
              <java.lang.Integer>8</java.lang.Integer>
            </numCPUs>              
            <memoryHotAddEnabled>
              <java.lang.Boolean>true</java.lang.Boolean>
            </memoryHotAddEnabled>
            <memoryMB>
              <java.lang.Long>16000</java.lang.Long>
            </memoryMB>                      
          </com.vmware.vim25.VirtualMachineConfigSpec>
        </param>
      </params>
    </command>

Return type : String

Command Input :

Variable Name

Variable Type

Description

VirtualCenter Server Name

String

VirtualCenter name where the virtual machine resides

VMConfigurationFilePath

String

URL to the XML file containing the configuration information

VMwareVirtualCenter

String 

the Keyword with constant

Syntax:


Virtualization executeCommand <VC Server Name> <PathToInputXMLFile> VMwareVirtualCenter

Example

The following example shows how to update the configuration of a virtual machine. 

Script

Virtualization executeCommand  testVC "//host/e/BLCLI-InputFiles/VMConfigurationInfo.xml"  VMwareVirtualCenter

The preceding command uses the VMConfigurationInfo.xml file as the input file and updates the following settings for the virtual machine, windows-vm:

  • CPU
  • Enable CPU Hot Add
  • Enable Memory Hot Add 
  • Memory


 

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