You can use the command line to add a single VM or multiple VMs as subclient content.
You can also add virtual machines to a subclient based on the folder, power status, notes, or custom attributes associated with the VM.
Procedure
-
Download the update_subclient_vm_template.xml file and save it on the computer where the command will be executed.
-
To add a single VM or all VMs that match specified criteria, execute the following command from the software_installation_directory/Base folder after substituting the parameter values.
Specify the VM name in the command line using the
vmContent/children/displayNameparameter. If you use a VM property instead of a VM name, any VMs that match the criteria you specify are added.qoperation execute -af $[update_subclient_vm_template.xml] -appName '$[Virtual Server]' -clientName $[xxxxx] -instanceName $[xxxxx] -backupsetName $[xxxxx] -subclientName $[xxxxx] -vmContent/children/displayName $[xxxxx] -vmContent/children/type $[VMName] -vmContentOperationType $[ADD] -
To add multiple VMs by name:
-
Open the .xml file and add the following line under the <vmContent> node to specify each virtual machine:
<children equalsOrNotEquals="$[1]" name="" displayName="$[MyVM]" type="$[VMName]"/>For example, to add three virtual machines (VM001, VM002 and VM003), add the following lines tothe XML:
<vmContent> <children equalsOrNotEquals="$[1]" name="" displayName="$[VM001]" type="$[VMName]"/> <children equalsOrNotEquals="$[1]" name="" displayName="$[VM002]" type="$[VMName]"/> <children equalsOrNotEquals="$[1]" name="" displayName="$[VM003]" type="$[VMName]"/> </vmContent> -
Execute the following command from the software_installation_directory/Base folder after substituting the parameter values.
qoperation execute -af $[update_subclient_vm_template.xml] -appName '$[Virtual Server]' -clientName $[xxxxx] -instanceName $[xxxxx] -backupsetName $[xxxxx] -subclientName $[xxxxx] -vmContentOperationType $[ADD]
-
Examples
-
Add by VM name: The following example adds a single virtual machine
VM01tosubclient1, underclient1, instanceVMware, andbackupset1.qoperation execute -af $[update_subclient_vm_template.xml] -appName '$[Virtual Server]' -clientName $[client1] -instanceName $[VMware] -backupsetName $[backupset1] -subclientName $[subclient1] -vmContent/children/displayName $[VM01] -vmContent/children/type $[VMName] -vmContentOperationType $[ADD]This example creates a rule of type "VM Name/Pattern" with the value "VM01" as the selection criterion. The rule only selects a VM that has the specified display name.
-
Add based on Folder: The following example adds virtual machines that are in a folder named TestFolder under the datacenter named datacenter.
Note
In the vCenter inventory, VM folders exist under a hidden folder named vm, which must be included as part of the path specified with the
vmContent/children/Nameparameter.qoperation execute -af $[.\update_subclient_vm_template.xml] -appName '$[Virtual Server]' -clientName $[DevVS VC] -instanceName $[VMware] -backupSetName $[defaultBackupSet] -subclientName $[commandline] -vmContent/children/Name '$[/datacenter/vm/TestFolder]' -vmContent/children/displayName $[TestFolder] -vmContent/children/type $[FOLDER] -vmContentOperationType $[ADD] -
Add based on Power Status: The following example adds virtual machines that are powered on:
qoperation execute -af update_subclient_vm_template.xml -appName '$[Virtual Server]' -clientName $[xxxxx] -instanceName $[xxxxx] -backupsetName $[xxxxx] -subclientName $[xxxxx] -vmContent/children/displayName Powered $[On] -vmContent/children/type $[VMPowerState] -vmContentOperationType $[ADD]
-
Add based on Notes: The following example adds virtual machines that have "Critical" in vCenter annotations for the VM summary:
qoperation execute -af update_subclient_vm_template.xml -appName '$[Virtual Server]' -clientName $[xxxxx] -instanceName $[xxxxx] -backupsetName $[xxxxx] -subclientName $[xxxxx] -vmContent/children/displayName $[Critical] -vmContent/children/type $[VMNotes] -vmContentOperationType $[ADD]
-
Add based on Custom Attributes: The following example adds virtual machines that have "resize" in a custom attribute that is part of vCenter annotations for the VM summary:
qoperation execute -af update_subclient_vm_template.xml -appName '$[Virtual Server]' -clientName $[xxxxx] -instanceName $[xxxxx] -backupsetName $[xxxxx] -subclientName $[xxxxx] -vmContent/children/displayName $[resize] -vmContent/children/type $[VMCustomAttribute] -vmContentOperationType $[ADD]